Here you can find the source of concatArray(byte data1[], byte data2[])
Parameter | Description |
---|---|
data1 | a parameter |
data2 | a parameter |
public static byte[] concatArray(byte data1[], byte data2[])
//package com.java2s; /******************************************************************************* * Copyright (c) 2008, 2014 IBM Corp.//from w w w .j ava 2s . c o m * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Eclipse Distribution License v1.0 which accompany this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * and the Eclipse Distribution License is available at * http://www.eclipse.org/org/documents/edl-v10.php. * * Contributors: * Ian Craggs - initial API and implementation and/or initial documentation *******************************************************************************/ public class Main { /** * @param data1 * @param data2 * @return */ public static byte[] concatArray(byte data1[], byte data2[]) { byte temp[] = new byte[data1.length + data2.length]; System.arraycopy(data1, 0, temp, 0, data1.length); System.arraycopy(data2, 0, temp, data1.length, data2.length); return (temp); } /** * @param data1 * @param off1 * @param len1 * @param data2 * @param off2 * @param len2 * @return */ public static byte[] concatArray(byte data1[], int off1, int len1, byte data2[], int off2, int len2) { byte temp[] = new byte[len1 + len2]; System.arraycopy(data1, off1, temp, 0, len1); System.arraycopy(data2, off2, temp, len1, len2); return (temp); } }