Here you can find the source of concatArrays(byte[][] arrays)
public static byte[] concatArrays(byte[][] arrays)
//package com.java2s; /*/*from w w w . j av a 2 s.co m*/ * gMix open source project - https://svs.informatik.uni-hamburg.de/gmix/ * Copyright (C) 2012 Karl-Peter Fuchs * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ public class Main { public static byte[] concatArrays(byte[][] arrays) { byte[] result = concatArrays(arrays[0], arrays[1]); for (int i = 2; i < arrays.length; i++) result = concatArrays(result, arrays[i]); return result; } public static byte[] concatArrays(byte[] firstArray, byte[] secondArray) { byte[] result = new byte[firstArray.length + secondArray.length]; System.arraycopy(firstArray, 0, result, 0, firstArray.length); System.arraycopy(secondArray, 0, result, firstArray.length, secondArray.length); return result; } public static double[] concatArrays(double[] firstArray, double[] secondArray) { double[] result = new double[firstArray.length + secondArray.length]; System.arraycopy(firstArray, 0, result, 0, firstArray.length); System.arraycopy(secondArray, 0, result, firstArray.length, secondArray.length); return result; } }