12345转换成字符String类型,然后截取字符串,再插入到字符数组
public class Test {
public static void main(String[] args) {
int a = 12345;
String s = Integer.toString(a);
String[] str = new String[s.length()];
for(int i = 0; i < s.length(); i++){
str[i] = s.substring(i, i+1);
System.out.println(str[i]);
}
}
}
int a = 12345;
String a1 = a+"";
int count = a1.length();
int t = 1;
int []b = new int [count];
for(int i = 0; i < count; i++){
b[i] = Integer.valueOf(String.valueOf(a1.charAt(i)));
}
for(int j = 0; j < b.length; j++){
System.out.println(b[j]);
}
}
for循环 吧int数组放到String数组里面
直接
str[0] = i[0]+"";