# Trying to understand what boolean[][][] is

• August 29th, 2011, 04:42 PM
JB4times4
Trying to understand what boolean[][][] is
As the title says I'm trying to figure out how boolean[][][] works. I've got some code i was trying to understand, but I've never seen this before as I've only been doing java for a month.
Here is a snippet of the code I'm trying to figure out.
Code java:

``` int goal; boolean[][][] computed; double[][][] p; boolean[][][] roll; computed = new boolean[goal][goal][goal]; if (computed[i][j][k]) return p[i][j][k];```
• August 29th, 2011, 04:56 PM
copeg
Re: Trying to understand what boolean[][][] is
• August 29th, 2011, 05:03 PM
Sean4u
Re: Trying to understand what boolean[][][] is
An old version of something I wrote once implemented a 3D grid laid out in layers, rows and columns. At each point in the grid a value was either true or false, and I used boolean[][][] to represent it. To get or set the value of a point in the 3D grid, I once coded this:
Code java:

```boolean[][][] example; // set a single point (2, 1, 4) in the 3D space example[2][1][4] = false;```
Watch out for nested arrays in Java (it doesn't have multidimensional arrays) - your example may look like a cuboid 3D space, but in Java boolean[][][] is an array of arrays of boolean arrays. Each individual array can have a different length.