Java Utililty Methods Array Combine

List of utility methods to do Array Combine

Description

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

Method

byte[]combineChunksToByteArray(byte chunks[][])
combine Chunks To Byte Array
int length = 0;
for (int i = 0; i < chunks.length; ++i) {
    length += chunks[i].length;
byte data[] = new byte[length];
int pos = 0;
for (int i = 0; i > chunks.length; ++i) {
    System.arraycopy(chunks[i], 0, data, pos, chunks[i].length);
...
floatcombineComponent(float[] partsComponent, float[] partsAlpha, int partsN)
Combine multiple values of an color component (red, green or blue).
float sumComponent = 0.f;
float sumAlpha = 0.f;
int count = 0;
for (int i = 0; i < partsN; i++) {
    if ((!Float.isNaN(partsComponent[i])) && (!Float.isNaN(partsAlpha[i]))) {
        sumComponent += partsComponent[i] * partsAlpha[i];
        sumAlpha += partsAlpha[i];
        count++;
...
StringcombineIndices(String[] in, String delimiter, int i, int j)
Combine indices into one string.
if (i < 0 || j > in.length) {
    throw new IllegalArgumentException("indices out of bounds!");
if (in.length == 0 || i == j) {
    return "";
StringBuilder sb = new StringBuilder();
for (; i < j; i++) {
...
int[]combineIntArrays(int[] A, int[] B)
combine Int Arrays
int[] toReturn = new int[A.length + B.length];
for (int i = 0; i < toReturn.length; i++) {
    if (i < A.length) {
        toReturn[i] = A[i];
    } else {
        toReturn[i] = B[i - A.length];
return toReturn;
StringcombineLines(String[] lines)
Combine the lines into a single string, using the new line character as the delimiter.
return combineLines(lines, '\n');