convert int array to integer array code example

Example 1: 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';
}

Example 2: convert int array to integer list java

int[] arr = {1,2,3};
IntStream.of(arr).boxed().collect(Collectors.toList());

Example 3: convert array of int to arraylist java

int[] ints = {1, 2, 3};
List<Integer> intList = new ArrayList<Integer>(ints.length);
for (int i : ints)
{
    intList.add(i);
}

Example 4: how to convert array to int

int i, k = 0;
for (i = 0; i < n; i++)
    k = 10 * k + a[i];

Example 5: java convert string array to int array

int[] intArray = convertStringArrayToIntArray(numbers.split(", "));