Re: Java Heap Space Error...

In a 3x2x6x6x4x5 6-D array you have 4320 data points.

That is you have 1 6-D Array.

You have 3 5-D Arrays

You have 6 4-D Arrays

You have 36 3-D Arrays

You have 216 2-D Arrays

For a total of 864 Length 5 1-D Arrays -> 864 * 5 = 4320.

Your Sum for loops are performing a total of 4320+864+216+36+6+3 additions for a total of 5445 additions. The extra 1125 additions are the most likely cause of the discrepancy.

Code:

`Sum += DATA[i][j][k][l][m][n].Sum; // First iteration this is Sum += DATA[0][0][0][0][0][0].Sum`

// Second iteration this is Sum += DATA[0][0][0][0][0][1].Sum

// Sixth iteration this is Sum += DATA[0][0][0][0][1][0].Sum