Java Array Concatenate concatArrays(byte[] a, byte[] b)

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

Description

concat Arrays

License

Open Source License

Declaration

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

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    private static final String ERROR_NULL_ARRAYS = "Given arrays can't be null.";

    public static byte[] concatArrays(byte[] a, byte[] b) {

        if (a == null || b == null) {
            throw new IllegalArgumentException(ERROR_NULL_ARRAYS);
        }/* www. j a v a 2s.  c o  m*/

        byte[] concat = new byte[a.length + b.length];
        for (int i = 0; i < concat.length; i++) {
            concat[i] = i < a.length ? a[i] : b[i - a.length];
        }

        return concat;
    }
}

Related

  1. concatArray(String string, String[] words)
  2. concatArray(String[] array, int start)
  3. concatArray(String[] array, int start, String def)
  4. concatArray(String[] array, String glue)
  5. concatArray(T[] first, T[]... rest)
  6. concatArrays(byte[]... arrays)
  7. concatArrays(byte[]... arrays)
  8. concatArrays(byte[]... byaArrays)
  9. concatArrays(byte[][] arrays)