Answers for "how to split an int"

2

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;

}

}
Posted by: Guest on January-18-2021
0

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]);
}
Posted by: Guest on July-08-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language