static int width, height, depth;
public static void Main()
width = height = depth = 2;
cube = new int[width * height * depth];
for(int i = 0; i < width * height * depth; i++) {
for(int z = 0; z < depth; z++) {
for(int y = 0; y < height; y++) {
for(int x = 0; x < width; x++) {
Console.WriteLine("#" + j + ": XYZ (" + x.ToString() + ", " + y.ToString() + ", " + z.ToString() + ") = " + cube[XYZToIndex(x, y, z)]);
static int XYZToIndex(int x, int y, int z) {
return x + (width * y) + (width * height * z);