Today our high-end,Domineering,high grade(高端霸气上档次)1027 group strat its first voyage.(please forgive me for decribing our group with so many adj)Now let's talk about the technology problem.
1:basic data type (eight)
2:String class
* 1.byte -128~127
* 2.short -2^32~2^32-1
* 3.int -4 bit~4 bit -1
* 4.long -8 bit~8 bit -1
* floating-point type(both are plus-minus)
* 5.float -16 bit~16 bit-1
* 6.double -32 bit~32 bit-1
* char type(only plus)
* 7.char 0~16 bit-1
* only true and false(boolean)
* 8.boolean true or false
* @author Administrator
be careful:the range of the data
type a=128;
type b=(type)a;(b=-128)
mission statistic every number of char's appearence code
just use the "toCharArray()" way and array
later on,i will improve it and try to use as many ways as possible in the String class.And by reaching to API frequently,i feel like i am gradually comprehending how to use it.There are still many problem in How to use String class flexible,but i think you can get the answer in the API which is incrediable useful.So tonight let's end with the famous saying "there always start with a big-bang".
1:basic data type (eight)
2:String class
* 1.byte -128~127
* 2.short -2^32~2^32-1
* 3.int -4 bit~4 bit -1
* 4.long -8 bit~8 bit -1
* floating-point type(both are plus-minus)
* 5.float -16 bit~16 bit-1
* 6.double -32 bit~32 bit-1
* char type(only plus)
* 7.char 0~16 bit-1
* only true and false(boolean)
* 8.boolean true or false
* @author Administrator
be careful:the range of the data
type a=128;
type b=(type)a;(b=-128)
mission statistic every number of char's appearence code
public class homework0703 {
public static void main(String[] args){
//define the string
String sa="euriyui3743289^%^&*&DJHK2312";
homework0703 ho=new homework0703();
//use statistics way
ho.statistics(sa);
}
public void statistics(String a){
//turn the string into char array
char sa[]=a.toCharArray();
int k=a.length();
//define other two array to store char and number
char sb[]=new char[k];//statistic the char
int sc[]=new int[k];//statistic the char number
int N=0;//counter
//search char from zero to k
for(int i=0;i<k;i++){
boolean NB=true;
//exam whether the char has appeared before or not
for(int j=0;j<i;j++){
if(sa[j]==sa[i])
NB=false;
}
if(NB)
{ sb[N]=sa[i];//assignment sa[] to sb[];
sc[N]=0;
//calculate the number of the char N
for(int p=i;p<k;p++){
if(sa[p]==sb[N]){
sc[N]++;
}
}
N++;
}
}
for(int i=0;i<N;i++){
System.out.print(sb[i]+" ");
System.out.println(sc[i]);
}
}
}
just use the "toCharArray()" way and array
later on,i will improve it and try to use as many ways as possible in the String class.And by reaching to API frequently,i feel like i am gradually comprehending how to use it.There are still many problem in How to use String class flexible,but i think you can get the answer in the API which is incrediable useful.So tonight let's end with the famous saying "there always start with a big-bang".