static int figureOutIndex(Dimension[] dimensions, int[] indexes) {
        int index = 0;

        for (int i = (dimensions.length - 1); i > 0; i--) {
            int mult = dimensions[0].getSize();
            for (int j = 1; j < i; j++) {
                mult = mult * dimensions[j].getSize();
            }
            index = index + (mult * indexes[i]);
        }
        index = index + indexes[0];

        return index;
    }