int[] i = {65,66};
char[] c = new char[i.length];
for (int j = 0; j < i.length; j++) {
c[j] = (char)i[j];
System.out.println(c[j]);
}
循环造型~~~
char[] c = new char[i.length];
for (int j = 0; j < i.length; j++) {
c[j] = (char)i[j];
System.out.println(c[j]);
}
循环造型~~~
{
public static void main(String arg[])
{
int[] i={1,2,3};
char[] c=new char[i.length];
for(int j=0;j<i.length;j++)
{
c[j]=(char)i[j]; }
for(int j=0;j<i.length;j++)
{
System.out.print(c[j]+",");
}
}
}
,,,Press any key to continue...
结果是乱码在豆号间
你转的1,2,3当然是非常规的的东西了
char[] c = new char[i.length];
for (int j = 0; j < i.length; j++) {
c[j] = Integer.toString(i[j]).toCharArray()[0];
}
如果楼主想不变值转换的话,可以采用上诉方法,这个能满足楼主1,2,3的需要,但是它只能完成一位数的,两位及以上的只保留最高位
int[] i = {1,2,3,25};
String[] s = new String[i.length];
for (int j = 0; j < i.length; j++) {
s[j] = Integer.toString(i[j]);
}