Here you can find the source of concatArrays(byte[]... arrays)
Parameter | Description |
---|---|
arrays | the arrays to concatenate together |
public static final byte[] concatArrays(byte[]... arrays)
//package com.java2s; /*/*from ww w . jav a 2 s . c o m*/ * This file is part of an unofficial ISO20008-2.2 sample implementation to * evaluate certain schemes for their applicability on Android-based mobile * devices. The source is licensed under the modified 3-clause BSD license, * see the readme. * * The code was published in conjunction with the publication called * "Group Signatures on Mobile Devices: Practical Experiences" by * Potzmader, Winter, Hein, Hanser, Teufl and Chen */ public class Main { /** * Takes a variable amount of byte arrays as input and returns a merged * byte array by concatenating the input in the order of the parameterlist. * * @param arrays the arrays to concatenate together * @return a merged byte array */ public static final byte[] concatArrays(byte[]... arrays) { int length = 0; for (byte[] arr : arrays) length += arr.length; byte[] merged = new byte[length]; int offset = 0; for (byte[] arr : arrays) { System.arraycopy(arr, 0, merged, offset, arr.length); offset += arr.length; } return merged; } }