Java examples for java.lang:int Array
Concatenate 2 arrays into 1.
//package com.java2s; import java.lang.reflect.Array; public class Main { /**//w ww . j a v a 2s . c om * Concatenate 2 arrays into 1. */ public static <T> T[] concatenate(T[] a, T... b) { int aLen = a.length; int bLen = b.length; @SuppressWarnings("unchecked") T[] C = (T[]) Array.newInstance(a.getClass().getComponentType(), aLen + bLen); System.arraycopy(a, 0, C, 0, aLen); System.arraycopy(b, 0, C, aLen, bLen); return C; } }