private void mergeRuns(int idx) {

        int indexA = runsIndices[idx];
        int lenA = runsLength[idx];
        int indexB = runsIndices[idx + 1];
        int lenB = runsLength[idx + 1];

        /*
         * Record the length of the combined runs; if idx is the 3rd-last
         * run now, also slide over the last run (which isn't involved
         * in this merge).  The current run (idx+1) goes away in any case.
         */
        runsLength[idx] = lenA + lenB;
        if (idx == nbRuns - 3) {
            runsIndices[idx + 1] = runsIndices[idx + 2];
            runsLength[idx + 1] = runsLength[idx + 2];
        }
        nbRuns--;

        /* Where does B start in A?  Elements in A before that can be
         * ignored (already in place).
         */
        //didn't find proper naming for k as it's used in the original implementation
        int k = gallopRight(array[indexB], array, indexA, lenA, 0, comparator);        
        indexA += k;
        lenA -= k;
        if (lenA == 0) {
            return;
        }

        /* Where does A end in B?  Elements in B after that can be
         * ignored (already in place).
         */
        lenB = gallopLeft(array[indexA + lenA - 1], array, indexB, lenB, lenB - 1, comparator);        
        if (lenB == 0) {
            return;
        }

        /* Merge what remains of the runs, using a temp array with
         * min(lengthA, lengthB) elements.
         */
        if (lenA <= lenB) {
            mergeLow(indexA, lenA, indexB, lenB);
        } else {
            mergeHigh(indexA, lenA, indexB, lenB);
        }
    }
Merge runs A and B where A index in the stack is idx and B index is idx+1

@param idx index of the first of two runs to merge
jme3-core/src/main/java/com/jme3/util/ListSort.java