Java Byte Array Combine combine(byte[] arr1, byte[] arr2)

Here you can find the source of combine(byte[] arr1, byte[] arr2)

Description

combine

License

Open Source License

Declaration

public static byte[] combine(byte[] arr1, byte[] arr2) 

Method Source Code

//package com.java2s;
/**//from  w  w  w  .ja v  a 2 s  .  co  m
 * Copyright (C) 2011-2017 ARM Limited. All rights reserved.
 * SPDX-License-Identifier: Apache-2.0
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

public class Main {
    public static byte[] combine(byte[] arr1, byte[] arr2) {
        byte[] newArr = new byte[arr1.length + arr2.length];
        System.arraycopy(arr1, 0, newArr, 0, arr1.length);
        System.arraycopy(arr2, 0, newArr, arr1.length, arr2.length);
        return newArr;
    }
}

Related

  1. combine(byte[] a, byte[] b)
  2. combine(byte[] first, byte[] second)
  3. combine(byte[] one, byte[] two, byte[] three, byte[] four)
  4. combine(byte[] one, byte[] two, byte[] three, byte[] four)
  5. combine(byte[]... bytes)