Answers for "integer to array of ints"

5

java int to int array

int number = 110101; 
String temp = Integer.toString(number);
int[] numbers = new int[temp.length()];
for (int i = 0; i < temp.length(); i++) {
    numbers[i] = temp.charAt(i) - '0';
}
Posted by: Guest on June-15-2020
0

int

int[] primitiveArray = { 1, 2, 3, 4, 5 };
 
Integer[] boxedArray = Arrays.stream(primitiveArray) // IntStream
  .boxed()                // Stream<Integer>
  .toArray(Integer[]::new);

System.out.println(Arrays.toString(boxedArray));
Posted by: Guest on January-01-1970

Code answers related to "integer to array of ints"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language