Speeding up code - 3D array
<p>I'm trying to improve the speed of some code I've written. I was wondering how efficient accessing data from a 3d array of integers is?</p>

<p>I have an array</p>

<p><code>int cube[][][] = new int[10][10][10];</code></p>

<p>which I populate with values. I then access these values several thousand times.</p>

<p>I was wondering, seeing as all 3d arrays are theoretically stored in 1D arrays in memory, is there a way to turn my 3d array into a 1d one? For instance I could have cube[0] referring to the old cube[0][0][0] and cube [1] refering to the old cube[0][0][1].</p>

<p>I'm not sure how to go about doing it. I'm sure it's possible but my brain is worn out. </p>

<p>Thanks</p>
