public static void rotateLeft2(int[] array, int shift) {
        if (shift <= 0 || array == null || array.length <= shift) {
            throw new IllegalArgumentException("Invalid args");
        }
        int n = array.length;
        int i, j, k, temp;
        for (i = 0; i < GCD.gcd(shift, n); i++) {
            /* move i-th values of blocks */
            temp = array[i];
            j = i;
            while (true) {
                k = j + shift;
                if (k >= n) {
                    k = k - n;
                }
                if (k == i) {
                    break;
                }
                array[j] = array[k];
                j = k;
            }
            array[j] = temp;
        }
    }