Here you can find the source of concatenate(byte[] a, byte[] b)
public static byte[] concatenate(byte[] a, byte[] b)
//package com.java2s; /*------------------------------------------------------------------------------------------------- - #%L - - chvote-protocol-poc - - %% - - Copyright (C) 2016 - 2017 R?publique et Canton de Gen?ve - - %% - - This program is free software: you can redistribute it and/or modify - - it under the terms of the GNU Affero 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 Affero General Public License - - along with this program. If not, see <http://www.gnu.org/licenses/>. - - #L% - -------------------------------------------------------------------------------------------------*/ import java.util.Arrays; public class Main { public static byte[] concatenate(byte[] a, byte[] b) { byte[] local_a = Arrays.copyOf(a, a.length); byte[] local_b = Arrays.copyOf(b, b.length); byte[] concatenated = new byte[local_a.length + local_b.length]; System.arraycopy(local_a, 0, concatenated, 0, local_a.length); System.arraycopy(local_b, 0, concatenated, local_a.length, local_b.length); return concatenated; }/*from w w w . j a v a2 s. com*/ }