question: private void mergeLo ( int base1 , int len1 , int base2 , int len2 ) { T [ ] a = this . a ; T [ ] tmp = ensureCapacity ( len1 ) ; int cursor1 = tmpBase ; int cursor2 = base2 ; int dest = base1 ; System . arraycopy ( a , base1 , tmp , cursor1 , len1 ) ; a [ dest ++ ] = a [ cursor2 ++ ] ; if ( -- len2 == 0 ) { System . arraycopy ( tmp , cursor1 , a , dest , len1 ) ; return ; } if ( len1 == 1 ) { System . arraycopy ( a , cursor2 , a , dest , len2 ) ; a [ dest + len2 ] = tmp [ cursor1 ] ; return ; } Comparator < ? super T > c = this . c ; int minGallop = this . minGallop ; outer : while ( true ) { int count1 = 0 ; int count2 = 0 ; do { if ( c . compare ( a [ cursor2 ] , tmp [ cursor1 ] ) < 0 ) { a [ dest ++ ] = a [ cursor2 ++ ] ; count2 ++ ; count1 = 0 ; if ( -- len2 == 0 ) break outer ; } else { a [ dest ++ ] = tmp [ cursor1 ++ ] ; count1 ++ ; count2 = 0 ; if ( -- len1 == 1 ) break outer ; } } while ( ( count1 | count2 ) < minGallop ) ; do { count1 = gallopRight ( a [ cursor2 ] , tmp , cursor1 , len1 , 0 , c ) ; if ( count1 != 0 ) { System . arraycopy ( tmp , cursor1 , a , dest , count1 ) ; dest += count1 ; cursor1 += count1 ; len1 -= count1 ; if ( len1 <= 1 ) break outer ; } a [ dest ++ ] = a [ cursor2 ++ ] ; if ( -- len2 == 0 ) break outer ; count2 = gallopLeft ( tmp [ cursor1 ] , a , cursor2 , len2 , 0 , c ) ; if ( count2 != 0 ) { System . arraycopy ( a , cursor2 , a , dest , count2 ) ; dest += count2 ; cursor2 += count2 ; len2 -= count2 ; if ( len2 == 0 ) break outer ; } a [ dest ++ ] = tmp [ cursor1 ++ ] ; if ( -- len1 == 1 ) break outer ; minGallop -- ; } while ( count1 >= MIN_GALLOP | count2 >= MIN_GALLOP ) ; if ( minGallop < 0 ) minGallop = 0 ; minGallop += 2 ; } this . minGallop = minGallop < 1 ? 1 : minGallop ; if ( len1 == 1 ) { System . arraycopy ( a , cursor2 , a , dest , len2 ) ; a [ dest + len2 ] = tmp [ cursor1 ] ; } else if ( len1 == 0 ) { throw new IllegalArgumentException ( "Comparison method violates its general contract!" ) ; } else { System . arraycopy ( tmp , cursor1 , a , dest , len1 ) ; } }
target:  Merges two adjacent runs in place, in a stable fashion.  The first element of the first run must be greater than the first element of the second run (a[base1] > a[base2]), and the last element of the first run (a[base1 + len1-1]) must be greater than all elements of the second run. For performance, this method should be called only when len1 <= len2; its twin, mergeHi should be called if len1 >= len2.  (Either method may be called if len1 == len2.)