public static void StringToIntArray(){
String string="1,2,3,4,5,6";
String str[]=string.split(",");
int IntArray[]=new int[str.length];
for(int i=0;i<str.length;i++){
IntArray[i]=Integer.parseInt(str[i]);
}
System.out.println("Without Arrays,it will be hexFormat,like:"+IntArray);
System.out.println("the StringToIntArray is: ..."+Arrays.toString(IntArray));
}
运行结果:
更多关于打印数组,请看这篇总结:
https://chinese.freecodecamp.org/news/java-array-methods-how-to-print-an-array-in-java/
标签:Java,数组,int,str,IntArray,String From: https://www.cnblogs.com/Trevor-Philips/p/16642314.html