code: private void sort(final T[] array, int start, int end, Comparator<T> lt) {
      if (start == end)
        return;
      if ((end - start) <= 15)
        this.selectionSort(array, start, end, lt);
      else {
        final T pivot = array[start + ((end - start) / 2)];
        T tmp;
        int i = start - 1;
        int j = end;
        while (true) {
          do
            i++;
          while (lt.compare(array[i], pivot) < 0);
          do
            j--;
          while (lt.compare(pivot, array[j]) < 0);
          if (i >= j)
            break;
          tmp = array[i];
          array[i] = array[j];
          array[j] = tmp;
        }
        this.sort(array, start, i, lt);
        this.sort(array, i, end, lt);
      }
    }
docs: Merge sort implementation for a given array.
  @param array the array
  @param start the start index for sorting
  @param end   the end index for sorting
  @param lt    the comparator for elements of the array