Here you can find the source of addByteArrays(byte[]... arrays)
Parameter | Description |
---|---|
arrays | The byte arrays to concatenate |
public static byte[] addByteArrays(byte[]... arrays)
//package com.java2s; public class Main { /**/*from w ww .j av a 2 s . c om*/ * Returns a byte array containing the first supplied byte array, followed by the second, followed * by the third, and so on... * * @param arrays The byte arrays to concatenate * @return The byte array which is all the supplied byte arrays concatenated in order */ public static byte[] addByteArrays(byte[]... arrays) { int length = 0; for (byte[] ba : arrays) { length += ba.length; } byte[] retArray = new byte[length]; int pos = 0; for (byte[] ba : arrays) { System.arraycopy(ba, 0, retArray, pos, ba.length); pos += ba.length; } return retArray; } }