Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

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);
}
Comment

java split int

String str = "1 16 217 22 992";

        String[] numbersAsStrings = str.split(" ");
        int[] numbers = new int[numbersAsStrings.length];

        for (int i = 0; i < numbersAsStrings.length; i++) {
            numbers[i] = Integer.parseInt(numbersAsStrings[i]);
        }
Comment

PREVIOUS NEXT
Code Example
Java :: how to use split on a file name java 
Java :: sorting list in java 
Java :: spring boot dockerfile 
Java :: advantages of exception handling in java 
Java :: java lb to kg 
Java :: java int array to integer arraylist 
Java :: remove last character from stringbuffer 
Java :: is java compiled or interpreted 
Java :: Program to remove duplicates in an ArrayList 
Java :: how to change java version in pom.xml 
Java :: how to change a character in a string in java with ascii 
Java :: how to compare strings java 
Java :: java check string contains uppercase character 
Java :: integer to binary java 
Java :: breadth first search bst java 
Java :: setting java home 
Java :: java node class 
Java :: actuator spring boot 
Java :: Loop in singly linked list 
Java :: java sort a map by keys 
Java :: java use variables inside strings 
Java :: Java Type conversion from String to int 
Java :: lowercase string java 
Java :: java spring username encode and decode 
Java :: how to change toolbar name in android studio 
Java :: kruskal java 
Java :: Java Access PriorityQueue Elements 
Java :: gui open event spigot 
Java :: What is the function of an IntentFilter? 
Java :: no of words in a string in java 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =