Java tutorial
//package com.java2s; //License from project: Apache License import java.lang.reflect.Array; public class Main { public static <T> T[] joinArrays(final Class<T> type, final T[]... arrs) { int total = 0; for (final T[] arr : arrs) { if (arr != null) total += arr.length; } final T[] ret = (T[]) Array.newInstance(type, total); int x = 0; for (final T[] arr : arrs) { if (arr != null) { System.arraycopy(arr, 0, ret, x, arr.length); x += arr.length; } } return ret; } }