Here you can find the source of concat(byte[] a, byte[]... b)
Parameter | Description |
---|---|
a | array 1 |
b | array 2 |
public static byte[] concat(byte[] a, byte[]... b)
//package com.java2s; //License from project: Open Source License import java.util.Arrays; public class Main { /**/*from w ww .j a v a2s . c o m*/ * Returns two byte arrays concatenated. * * @param a array 1 * @param b array 2 * @return concatenation of array 1 and 2 */ public static byte[] concat(byte[] a, byte[]... b) { int length = a.length; for (byte[] bytes : b) { length += bytes.length; } byte[] result = Arrays.copyOf(a, length); int pos = a.length; for (byte[] bytes : b) { System.arraycopy(bytes, 0, result, pos, bytes.length); pos += bytes.length; } return result; } }