public void innerMergeHigh(Comparator<T> comp, T[] tempArray, T[] arr, int idxA) {
        lengthA--;
        if (lengthA == 0 || lengthB == 1) {
            return;
        }
        if (lengthB == 1) {
            return;
        }
        while (true) {
            // Number of wins by run A
            int aWins = 0;
            // Number of wins by run B
            int bWins = 0;

            /*
             * Do the straightforward thing until (if ever) one run
             * appears to win consistently.
             */
            do {                
                if (comp.compare(tempArray[iterB], arr[iterA]) < 0) {
                    arr[dest] = arr[iterA];
                    dest--;
                    iterA--;
                    aWins++;
                    bWins = 0;
                    lengthA --;
                    if (lengthA == 0) {
                        return;
                    }
                } else {
                    arr[dest] = tempArray[iterB];
                    dest--;
                    iterB--;
                    bWins++;
                    aWins = 0;
                    lengthB--;
                    if (lengthB == 1) {
                        return;
                    }
                }
            } while ((aWins | bWins) < minGallop);

            /*
             * One run is winning so consistently that galloping may be a
             * huge win. So try that, and continue galloping until (if ever)
             * neither run appears to be winning consistently anymore.
             */
            do {                
                aWins = lengthA - gallopRight(tempArray[iterB], arr, idxA, lengthA, lengthA - 1, comp);
                if (aWins != 0) {
                    dest -= aWins;
                    iterA -= aWins;
                    lengthA -= aWins;
                    System.arraycopy(arr, iterA + 1, arr, dest + 1, aWins);
                    if (lengthA == 0) {
                        return;
                    }
                }
                arr[dest] = tempArray[iterB];
                dest--;
                iterB--;
                lengthB--;
                if (lengthB == 1) {
                    return;
                }

                bWins = lengthB - gallopLeft(arr[iterA], tempArray, 0, lengthB, lengthB - 1, comp);
                if (bWins != 0) {
                    dest -= bWins;
                    iterB -= bWins;
                    lengthB -= bWins;
                    System.arraycopy(tempArray, iterB + 1, arr, dest + 1, bWins);
                    /* lengthB==0 is impossible now if the comparison
                    * function is consistent, but we can't assume
                    * that it is.
                    * a proper error will be thrown in mergeLow if lengthB == 0
                    */
                    if (lengthB <= 1){
                        return;
                    }
                }
                arr[dest] = arr[iterA];     
                dest--;
                iterA--;
                lengthA--;
                if (lengthA == 0) {
                    return;
                }
                minGallop--;
            } while (aWins >= MIN_GALLOP || bWins >= MIN_GALLOP);
            if (minGallop < 0) {
                minGallop = 0;
            }
            //original implementation uses +1 to penalize, Java7 Timsort uses +2
            minGallop += 2;  // Penalize for leaving gallop mode
        }
    }
Attempt to unroll "goto" style original implementation.
this method uses and change temp attributes of the class
@param comp comparator
@param arr the array
@param tempArray the temp array
@param idxA the index of the first element of run A
jme3-core/src/main/java/com/jme3/util/ListSort.java