array of Integer java code example
Example 1: java int array
int[] theNumbers = new int[5];
arr[0] = 4;
arr[1] = 8;
arr[2] = 15;
arr[3] = 16;
arr[4] = 23;
arr[5] = 42;
Example 2: java how to initialize an array
int[] arr = new int[10];
Example 3: java array
int arr[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
int newarr[] = new int[maxSize];
newarr[pos] = n;
for (i = 0; i < maxSize; i++) { newarr[i] = arr[i]; }
Example 4: int array java
int[] myIntArray = new int[3];
int[] myIntArray = {1, 2, 3};
int[] myIntArray = new int[]{1, 2, 3};
int [] myIntArray = IntStream.range(0, 100).toArray();
int [] myIntArray = IntStream.rangeClosed(0, 100).toArray();
int [] myIntArray = IntStream.of(12,25,36,85,28,96,47).toArray();
int [] myIntArray = IntStream.of(12,25,36,85,28,96,47).sorted().toArray();