Java Utililty Methods Byte Array Add

List of utility methods to do Byte Array Add

Description

The list of methods to do Byte Array Add are organized into topic(s).

Method

byte[]addByteArrays(byte[] array1, byte[] array2)
add Byte Arrays
byte[] concatenatedArray = new byte[array1.length + array2.length];
System.arraycopy(array1, 0, concatenatedArray, 0, array1.length);
System.arraycopy(array2, 0, concatenatedArray, array1.length, array2.length);
return concatenatedArray;
byte[]addByteArrays(byte[]... arrays)
Returns a byte array containing the first supplied byte array, followed by the second, followed by the third, and so on...
int length = 0;
for (byte[] ba : arrays) {
    length += ba.length;
byte[] retArray = new byte[length];
int pos = 0;
for (byte[] ba : arrays) {
    System.arraycopy(ba, 0, retArray, pos, ba.length);
...
byte[]addBytes(byte[] array, byte[] value)
add Bytes
if (null != array) {
    byte newarray[] = new byte[array.length + value.length];
    System.arraycopy(array, 0, newarray, 0, array.length);
    System.arraycopy(value, 0, newarray, array.length, value.length);
    array = newarray;
} else {
    array = value;
return array;
byte[]addBytes(byte[] initBytes, byte[] addBytes)
add Bytes
byte[] b = new byte[initBytes.length + addBytes.length];
try {
    System.arraycopy(initBytes, 0, b, 0, initBytes.length);
    for (int i = 0; i < addBytes.length; i++) {
        b[i + initBytes.length] = addBytes[i];
} catch (Exception e) {
return b;
byte[]addBytes(byte[][] src)
add Bytes
int length = 0;
for (int i = 0; i < src.length; i++) {
    if (src[i] != null)
        length += src[i].length;
byte[] score = new byte[length];
int index = 0;
for (int i = 0; i < src.length; i++) {
...
byte[]appendByte(byte[] bytes, byte b)
append Byte
byte[] result = Arrays.copyOf(bytes, bytes.length + 1);
result[result.length - 1] = b;
return result;
byte[]appendByte(byte[] bytes, byte b)
Creates a copy of bytes and appends b to the end of it
byte[] result = Arrays.copyOf(bytes, bytes.length + 1);
result[result.length - 1] = b;
return result;