Answers for "split int java"

4

how to store a 6 digit number as 6 separate integers

int number; // = some int

while (number > 0) {
    print( number % 10);
    number = number / 10;
}
Posted by: Guest on October-19-2020
44

How to split a string in Java

String string = "004-034556";
String[] parts = string.split("-");
String part1 = parts[0]; // 004
String part2 = parts[1]; // 034556
Posted by: Guest on February-01-2020
0

split number java

int num = 5542;
String number = String.valueOf(num);
for(int i = 0; i < number.length(); i++) {
    int j = Character.digit(number.charAt(i), 10);
    System.out.println("digit: " + j);
}
Posted by: Guest on August-27-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