Java Byte Array Combine combine(final byte[] array1, final byte[] array2)

Here you can find the source of combine(final byte[] array1, final byte[] array2)

Description

combine

License

Open Source License

Declaration

public static byte[] combine(final byte[] array1, final byte[] array2) 

Method Source Code

//package com.java2s;
// it under the terms of the GNU General Public License as published by

public class Main {
    public static byte[] combine(final byte[] array1, final byte[] array2) {
        if (array1 == null)
            return copy(array2);
        else if (array2 == null)
            return copy(array1);
        final byte[] joinedArray = new byte[array1.length + array2.length];
        System.arraycopy(array1, 0, joinedArray, 0, array1.length);
        System.arraycopy(array2, 0, joinedArray, array1.length, array2.length);
        return joinedArray;
    }/*w w w. j  ava2s  .  c  om*/

    public static byte[] copy(final byte[] array) {
        if (array == null)
            return null;
        return array.clone();
    }
}

Related

  1. combine(byte[] first, byte[] second)
  2. combine(byte[] one, byte[] two, byte[] three, byte[] four)
  3. combine(byte[] one, byte[] two, byte[] three, byte[] four)
  4. combine(byte[]... bytes)
  5. combine(byte[][] arr)
  6. combineArrays(byte[]... a)
  7. combineInsertB2sizeAsByte(byte[] b1, byte[] b2)