Merging K Sorted Arrays
No need to copy first array

Right now, you have this code that copies the first array into mergeArray, and then you start the merging loop:


    int[] mergeArray = new int[arrays[0].length];
    System.arraycopy(arrays[0], 0, mergeArray, 0, arrays[0].length);

    for(int i = 1; i &lt; arrays.length; i++) {
        mergeArray = merge(mergeArray, arrays[i]);
    }



You don't actually need to do this copy.  Instead, you can just do this:

    int[] mergeArray = arrays[0];

    for(int i = 1; i &lt; arrays.length; i++) {
        mergeArray = merge(mergeArray, arrays[i]);
    }


Reduce bounds checking

Your merging function is correct, but it checks both the left and right bounds on each iteration:


    while(index != mergeArr.length){
        if(left == arr1.length) {
            while(right != arr2.length) {
                mergeArr[index++] = arr2[right++];
            }
        } else if(right == arr2.length) {
            while(left != arr1.length) {
                mergeArr[index++] = arr1[left++];
            }
        } else {
            if(arr1[left] &lt; arr2[right]) {
                mergeArr[index++] = arr1[left++];
            } else {
                mergeArr[index++] = arr2[right++];
            }
        }
    }



It would be slightly faster to only checking the bound that was moved:

    while (true) {
        if (arr1[left] &lt; arr2[right]) {
            mergeArr[index++] = arr1[left++];
            if (left == arr1.length) {
                while (right != arr2.length) {
                    mergeArr[index++] = arr2[right++];
                }
                break;
            }
        } else {
            mergeArr[index++] = arr2[right++];
            if (right == arr2.length) {
                while (left != arr1.length) {
                    mergeArr[index++] = arr1[left++];
                }
                break;
            }
        }
    }


If you make this change, you also need to add a check before the loop that handles the case where one or both of the arrays had length 0.