Here you can find the source of merge(byte[]... arrays)
Parameter | Description |
---|---|
arrays | - arrays to merge |
public static byte[] merge(byte[]... arrays)
//package com.java2s; //License from project: Open Source License public class Main { /**//from w w w . j a va2 s. c o m * @param arrays - arrays to merge * @return - merged array */ public static byte[] merge(byte[]... arrays) { int arrCount = 0; int count = 0; for (byte[] array : arrays) { arrCount++; count += array.length; } // Create new array and copy all array contents byte[] mergedArray = new byte[count]; int start = 0; for (byte[] array : arrays) { System.arraycopy(array, 0, mergedArray, start, array.length); start += array.length; } return mergedArray; } }