Java Byte Array Combine combineInsertB2sizeAsByte(byte[] b1, byte[] b2)

Here you can find the source of combineInsertB2sizeAsByte(byte[] b1, byte[] b2)

Description

combine Insert Bsize As Byte

License

Open Source License

Declaration

public static byte[] combineInsertB2sizeAsByte(byte[] b1, byte[] b2) 

Method Source Code

//package com.java2s;

public class Main {
    public static byte[] combineInsertB2sizeAsByte(byte[] b1, byte[] b2) {
        if (b1 == null)
            throw new NullPointerException();
        if (b2 == null)
            throw new NullPointerException();

        byte[] ret = new byte[b1.length + b2.length + 1];
        for (int i = 0; i < b1.length; i++)
            ret[i] = b1[i];/*from w w w  .  j a va  2s. c  o m*/
        ret[b1.length] = (byte) b2.length;
        for (int i = 0; i < b2.length; i++)
            ret[b1.length + 1 + i] = b2[i];
        return ret;
    }
}

Related

  1. combine(byte[] one, byte[] two, byte[] three, byte[] four)
  2. combine(byte[]... bytes)
  3. combine(byte[][] arr)
  4. combine(final byte[] array1, final byte[] array2)
  5. combineArrays(byte[]... a)