Here you can find the source of append(byte[] data, byte[] adata)
public static byte[] append(byte[] data, byte[] adata)
//package com.java2s; public class Main { public static byte[] append(byte[] data, byte[] adata) { if (data == null) { data = new byte[0]; }/*from w w w. java 2s . co m*/ int len = data.length; if (adata == null) { return data; } int alen = adata.length; byte[] result = new byte[(len + alen)]; for (int i = 0, j = 0; i < len + alen; i++) { if (i < len) { result[i] = data[i]; continue; } result[i] = adata[j]; j++; } return result; } }