private static <T extends Comparable<? super T>> void quicksort(T[] a, int lo, int hi) {
        if (hi <= lo) return;
        int i = lo;
        int j = hi;
        T partitionItem = a[lo + (hi-lo)/2];

        while (i<=j) {
            while (isLess(a[i], partitionItem)) i++;
            while (isLess(partitionItem, a[j])) j--;

            if (i <= j) {
                exchange(a, i, j);
                i++;j--;
            }
        }

        if (lo<j)quicksort(a, lo, j);
        if (i<hi)quicksort(a, j + 1, hi);
    }