public void shellSort() {
        int inc, i, j, s, s1, p1, p2, p3;
        Integer[] seq = new Integer[myArray.length];
        p1 = p2 = p3 = 1;
        s1 = -1;
        do {
            if ( (++s1 % 2) != 0 ) {
                seq[s1] = 8 * p1 - 6 * p2 + 1;
            } else {
                seq[s1] = 9 * p1 - 9 * p3 + 1;
                p2 *= 2;
                p3 *= 2;
            }
            p1 *= 2;
        } while (3 * seq[s1] < myArray.length);
        if (s1 > 0) {
            --s1;
        }
        else {
            s1 = 0;
        }
        s = s1;

        while (s >= 0) {
            inc = seq[s--];
            for (i = inc; i < myArray.length; i++) {
                T temp = myArray[i];
                for (j = i - inc; (j >= 0) && (myArray[j].compareTo(temp) > 0); j -= inc) {
                    myArray[j + inc] = myArray[j];
                }
                myArray[j + inc] = temp;
            }
        }
    }