if (cmp.compare(a[lo], a[hi]) > 0)
if (cmp.compare(a[lo], a[hi - 1]) > 0)
    private void quickSortHelper(Object[] a, int lo, int hi, Comparator cmp) {        for (;;) {            int diff = hi - lo;            if (diff <= QUICKSORT_THRESHOLD)                break;            int i = (hi + lo) / 2;            if (cmp.compare(a[lo], a[i]) > 0)                swap(lo, i);            if (cmp.compare(a[lo], a[hi]) > 0)                swap(lo, hi);            if (cmp.compare(a[i], a[hi]) > 0)                swap(i, hi);            int j = hi - 1;            swap(i, j);            i = lo;            Object v = a[j];            for (;;) {                while (cmp.compare(a[++i], v) < 0) /* nothing */;                while (cmp.compare(a[--j], v) > 0) /* nothing */;                if (j < i) break;                swap(i, j);            }            swap(i, hi - 1);            if (j - lo <= hi - i + 1) {                quickSortHelper(a, lo, j, cmp);                lo = i + 1;            } else {                quickSortHelper(a, i + 1, hi, cmp);                hi = j;            }        }    }