public static void main(String[] args) {
        int[] gaps = {1, 4, 10, 23, 57, 132, 301, 701, 1750};

        int[] arrays = {7, 52, 3, 5, 79, 0, 1};

        int length = arrays.length;

        int gapIndex = 0;

        for (; gaps[gapIndex] < length; gapIndex++) ;

        while (gapIndex-- > 0) {

            int gap = gaps[gapIndex];

            for (int i = gap; i < length; i++) {

                int j = i;
                int temp = arrays[i];

                while (j >= gap && temp < arrays[j - gap]) {

                    arrays[j] = arrays[j - gap];

                    j = j - gap;

                }
                arrays[j] = temp;
            }
        }

        System.out.println(Arrays.toString(arrays));

    }