Android Array Concatenate concatenate(byte[]... bytes)

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

Description

concatenate

License

Apache License

Declaration

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

Method Source Code

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

Related

  1. cancat(byte[] a, byte[] b)
  2. arrayApend(byte[] prep, byte after)
  3. arrayComb(byte[] prep, byte[] after)
  4. concat(T[] a, T[] b)
  5. concatAll(T[] first, T[]... rest)
  6. concat(T[] first, T[] second)
  7. concat(byte[] b1, byte[] b2)
  8. append(byte[] pck1, byte[] pck2)
  9. addBytes(byte[] src1, byte[] src2)