Java Utililty Methods Array Append

List of utility methods to do Array Append

Description

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

Method

StringBuilderappendArray(StringBuilder sb, T[] array, String delimiter)
Appends all elements of array to buffer, separated by delimiter
boolean firstRun = true;
for (T elem : array) {
    if (!firstRun)
        sb.append(delimiter);
    else
        firstRun = false;
    sb.append(elem.toString());
return sb;
byte[]appendArrays(byte[] in1, byte[] in2)
append two arrays
byte[] ret = new byte[in1.length + in2.length];
System.arraycopy(in1, 0, ret, 0, in1.length);
System.arraycopy(in2, 0, ret, in1.length, in2.length);
return ret;
byte[]appendArrays(final byte[] firstArray, final byte[] secondArray)
append Arrays
validateNotNull(firstArray, "Appended array cannot be null");
validateNotNull(secondArray, "Appended array cannot be null");
final byte[] result = new byte[firstArray.length + secondArray.length];
System.arraycopy(firstArray, 0, result, 0, firstArray.length);
System.arraycopy(secondArray, 0, result, firstArray.length, secondArray.length);
return result;
int[]ARRAY_AddValueToArray(int new_value, int[] array)
Adds a new value to the int[] array
int arr_length = 1;
if (array != null && array.length != 0)
    arr_length = array.length + 1;
int[] result = new int[arr_length];
for (int x = 0; x < array.length; x++) {
    result[x] = array[x];
result[result.length - 1] = new_value;
...
byte[]arrayAppend(byte[] original, byte[] append)
array Append
byte[] newArray = new byte[original.length + append.length];
System.arraycopy(original, 0, newArray, 0, original.length);
System.arraycopy(append, 0, newArray, original.length, append.length);
return newArray;