Java Array Merge merge(byte[]... bytes)

Here you can find the source of merge(byte[]... bytes)

Description

merge

License

Open Source License

Declaration

public static byte[] merge(byte[]... bytes) 

Method Source Code

//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;
    }
}

Related

  1. merge(byte[] array1, byte[] array2)
  2. merge(byte[] signature, byte[] message)
  3. merge(byte[] src, byte[] src2, int start, int length)
  4. merge(byte[] src1, byte[] src2)
  5. merge(byte[]... arrays)
  6. merge(double[] a, int[] b, int p, int q, int r)
  7. merge(double[]... args)
  8. merge(E[] a1, E[] a2)
  9. merge(E[] arrayA, E[] arrayB)