Here you can find the source of merge(byte[]... bytes)
public static byte[] merge(byte[]... bytes)
//package com.java2s; /**/* w ww . j av a 2 s . co m*/ * @(#)ByteUtils.java, 2013-2-24. * * Copyright 2013 Netease, Inc. All rights reserved. * NETEASE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ public class Main { public static byte[] merge(byte[]... bytes) { byte[] result = null; int length = 0; for (byte[] t : bytes) { length += t.length; } result = new byte[length]; int index = 0; for (byte[] t : bytes) { System.arraycopy(t, 0, result, index, t.length); index += t.length; } return result; } }