To resize an array in Java, make a new, bigger array, then copy the current array into the new one with
System.arraycopy
.Here's how you do it:
int[] array = new int[] { 3, 5, 7, 11 };
int[] biggerArray = new int[10];
System.arraycopy(array, 0, biggerArray, 0, array.length);
System.out.println(Arrays.toString(array)); // [3, 5, 7, 11]
System.out.println(Arrays.toString(biggerArray)); // [3, 5, 7, 11, 0, 0, 0, 0, 0, 0]