Java Array Concatenate concatArrays(final byte[] arr1, final byte[] arr2)

Here you can find the source of concatArrays(final byte[] arr1, final byte[] arr2)

Description

Concatenate arrays.

License

Open Source License

Parameter

Parameter Description
arr1 Array1
arr2 Array2

Return

[Array1] + []Array2]

Declaration

public static byte[] concatArrays(final byte[] arr1, final byte[] arr2) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from   w  w w.ja va  2 s.  co  m
     * Concatenate arrays.
     * 
     * @param arr1
     *            Array1
     * @param arr2
     *            Array2
     * @return [Array1] + []Array2]
     */
    public static byte[] concatArrays(final byte[] arr1, final byte[] arr2) {
        final byte result[] = new byte[arr1.length + arr2.length];

        System.arraycopy(arr1, 0, result, 0, arr1.length);
        System.arraycopy(arr2, 0, result, arr1.length, arr2.length);

        return result;
    }
}

Related

  1. concatArrays(byte[]... arrays)
  2. concatArrays(byte[]... arrays)
  3. concatArrays(byte[]... byaArrays)
  4. concatArrays(byte[][] arrays)
  5. concatArrays(double[] d1, double[] d2)
  6. concatArrays(final char[] first, final char[]... rest)
  7. concatArrays(Object[] ar1, Object[] ar2)
  8. concatArrays(short[] arr1, short[] arr2)
  9. concatArrays(String[] A, String[] B)