Android Byte Array Concatenate concat(byte[] a, byte[] b)

Here you can find the source of concat(byte[] a, byte[] b)

Description

Join two bytearrays

License

Open Source License

Parameter

Parameter Description
a a parameter
b a parameter

Declaration

public static byte[] concat(byte[] a, byte[] b) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from w ww .j  a va 2  s . com
     * Join two bytearrays 
     * 
     * @param a
     * @param b
     * @return
     */
    public static byte[] concat(byte[] a, byte[] b) {
        byte[] result = new byte[a.length + b.length];
        System.arraycopy(a, 0, result, 0, a.length);
        System.arraycopy(b, 0, result, a.length, b.length);
        return result;
    }
}

Related

  1. concat(byte[] base, byte... extension)
  2. concat(int[] base, int... extension)
  3. concatByteArray(byte[] a, byte[] b)
  4. copyBytesIntoByteArray(byte[] dest, byte[] src)