Java tutorial
//package com.java2s; import java.lang.reflect.Array; public class Main { @SuppressWarnings("unchecked") public static <T> T[] addToArray(T[] array1, T[] array2) { Class<?> componentType = array1.getClass().getComponentType(); final Object newArray = Array.newInstance(componentType, array1.length + array2.length); System.arraycopy(array1, 0, newArray, 0, array1.length); System.arraycopy(array2, 0, newArray, array1.length, array2.length); return (T[]) newArray; } }