java中,若有int变量12345,如何转换成string 类型数组["1","2","3","4","5"]

说错了,是int类型数组

第1个回答  2013-02-06
12345转换成字符String类型,然后截取字符串,再插入到字符数组本回答被提问者采纳
第2个回答  推荐于2017-12-28
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]);
}
}
}

本回答被网友采纳
第3个回答  2013-02-06
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]);
}
}
第4个回答  2013-02-06
for循环 吧int数组放到String数组里面
第5个回答  2013-02-06
直接
str[0] = i[0]+"";