char数组转为int数组
public class Test {
public static void main(String[] args){
char[] ch = {'3','5','2','4','0','8','1'};
int[] toInt = new int[ch.length];
for(int i=0;i<ch.length;i++){
toInt[i] = Integer.parseInt(String.valueOf(ch[i]));
System.out.print(toInt[i]);
}
}
}
补充:
valueOf用法:
static Integer valueOf(int i)
static Integer valueOf(String s)
static Integer valueOf(String s, int radix)
Integer.parseInt用法:
String转数字