To merge two integer arrays in Java, use
System.arraycopy
.Here's how you do it:
int[] array1 = new int[] { 1, 2, 3, 4, 5 };
int[] array2 = new int[] { 6, 7, 8, 9, 0 };
int[] merged = new int[array1.length + array2.length];
System.arraycopy(array1, 0, merged, 0, array1.length);
System.arraycopy(array2, 0, merged, array1.length, array2.length);
// [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
System.out.println(java.util.Arrays.toString(merged));