private static void merge(Comparable[] array, int low, int middle, int high) {
        Comparable[] tempArray = new Comparable[array.length];
        int i = low;
        int j = middle + 1;
        for(int q = low; q <= high; q++) {
            tempArray[q] = array[q];
        }
        for(int q = low; q <= high; q++) {
            if (i > middle) {
                array[q] = tempArray[j++];
            } else if(j > high) {
                array[q] = tempArray[i++];
            } else if(tempArray[j].compareTo(tempArray[i]) < 0) {
                array[q] = tempArray[j++];
            } else {
                array[q] = tempArray[i++];
            }
        }
    }