Java tutorial
//package com.java2s; //License from project: Apache License import java.lang.reflect.Array; public class Main { public static Object combineArray(Object firstArray, Object secondArray) { int firstLength = Array.getLength(firstArray); int secondLength = Array.getLength(secondArray); int length = firstLength + secondLength; Class<?> componentType = firstArray.getClass().getComponentType(); Object newArray = Array.newInstance(componentType, length); for (int i = 0; i < length; i++) { if (i < firstLength) { Array.set(newArray, i, Array.get(firstArray, i)); } else { Array.set(newArray, i, Array.get(secondArray, i - firstLength)); } } return newArray; } }