Java tutorial
//package com.java2s; /** * 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; } }