static void figureOutIndexes(int index, int[] sizes, int[] indexes) {
        int prev_div = 0;

        for (int i = (sizes.length - 1); i > 0; i--) {
            int div = sizes[0];
            for (int j = 1; j < i; j++) {
                div = div * sizes[j];
            }
            indexes[i] = (index - prev_div) / div;
            prev_div = (indexes[i] * div) + prev_div;
        }
        indexes[0] = index - prev_div;
    }