Java tutorial
//package com.java2s; public class Main { /** * Works with two arrays of the same class type. * * @param a * @param b * @return */ public static <T> T[] concatArrays(T[] a, T[] b) { final int alen = a.length; final int blen = b.length; @SuppressWarnings("unchecked") final T[] result = (T[]) java.lang.reflect.Array.newInstance(a.getClass().getComponentType(), alen + blen); System.arraycopy(a, 0, result, 0, alen); System.arraycopy(b, 0, result, alen, blen); return result; } }