String str="222";
char[] value=str.toCharArray();
if(i == 0 && value.length > 0)
{
char ac[] = value;
for(int j = 0; j < value.length; j++){
System.out.println("+++++++++"+i);
i = 31 * i + ac[j];
char a='1';
System.out.println(a);
System.out.println(ac[j]);
System.out.println("---------"+i);
}
}
char[] value=str.toCharArray();
if(i == 0 && value.length > 0)
{
char ac[] = value;
for(int j = 0; j < value.length; j++){
System.out.println("+++++++++"+i);
i = 31 * i + ac[j];
char a='1';
System.out.println(a);
System.out.println(ac[j]);
System.out.println("---------"+i);
}
}
将string转换为字符数组,通过字符数组,在ascii中获得字符的十进制,进行计算