Here you can find the source of concatenate(byte[]... bytes)
public static byte[] concatenate(byte[]... bytes)
//package com.java2s; /**/*from w w w .j ava 2s . co m*/ * Source obtained from crypto-gwt. Apache 2 License. * https://code.google.com/p/crypto-gwt/source/browse/crypto-gwt/src/main/java/com/googlecode/ * cryptogwt/util/ByteArrayUtils.java */ public class Main { public static byte[] concatenate(byte[]... bytes) { int length = 0; for (byte[] array : bytes) length += array.length; byte[] result = new byte[length]; int offset = 0; for (byte[] array : bytes) { System.arraycopy(array, 0, result, offset, array.length); offset += array.length; } return result; } }