Объединить два массива Java
//USing Apache Commons Lang library.
int[] both = ArrayUtils.addAll(first, second);
Spotless Shark
//USing Apache Commons Lang library.
int[] both = ArrayUtils.addAll(first, second);
Object[] arrThree = new Object[arrTwo.length + arrOne.length];
int index = arrTwo.length;
for (int i = 0; i < arrTwo.length; i++) {
arrThree[i] = arrTwo[i];
}
for (int i = 0; i < arrOne.length; i++) {
arrThree[i + index] = arrOne[i];
}
public static void main(String[] args) {
int[] x = {1, 2, 3};
int[] y = {4, 5, 6};
int[] merge = new int[x.length + y.length];
for (int i = 0; i < x.length; i++) {
merge[i] += x[i];
}
for (int i = 0; i < y.length; i++) {
merge[x.length + i] += y[i];
}
System.out.println(Arrays.toString(merge));
}