数字字符串转int数组
程序员文章站
2022-07-15 08:58:13
...
String str = "1,2,3,4,5,6";
String[] array = str.split(",");
int[] intArray=new int[array.length];
for(int i=0;i<array.length;i++){
intArray[i]=Integer.parseInt(array[i]);
}
System.out.println(Arrays.toString(intArray));