Here you can find the source of concat(byte[] first, byte[] second)
public static byte[] concat(byte[] first, byte[] second)
//package com.java2s; //License from project: Open Source License import java.util.Arrays; public class Main { public static byte[] concat(byte[] first, byte[] second) { if (first == null) { if (second == null) { return null; }// ww w. ja va 2s . c o m return second; } if (second == null) { return first; } byte[] result = Arrays.copyOf(first, first.length + second.length); System.arraycopy(second, 0, result, first.length, second.length); return result; } public static int[] concat(int[] first, int[] second) { if (first == null) { if (second == null) { return null; } return second; } if (second == null) { return first; } int[] result = Arrays.copyOf(first, first.length + second.length); System.arraycopy(second, 0, result, first.length, second.length); return result; } public static long[] concat(long[] first, long[] second) { if (first == null) { if (second == null) { return null; } return second; } if (second == null) { return first; } long[] result = Arrays.copyOf(first, first.length + second.length); System.arraycopy(second, 0, result, first.length, second.length); return result; } public static <T> T[] concat(T[] first, T[] second) { if (first == null) { if (second == null) { return null; } return second; } if (second == null) { return first; } T[] result = Arrays.copyOf(first, first.length + second.length); System.arraycopy(second, 0, result, first.length, second.length); return result; } }