string concatenation split while converting to int code example
Example 1: how to separate a number into digits java
public static void main(String[] args) {
int num=1020; // int number
while (num > 0) {
System.out.println( num % 10);
num = num / 10;
}
}
Example 2: split string into int array
String[] strArray = input.split(",");
int[] intArray = new int[strArray.length];
for(int i = 0; i < strArray.length; i++) {
intArray[i] = Integer.parseInt(strArray[i]);
}