I am working with datasets that contain x,y,z coordinates for each position (size = 40,40,40 for this instance).
My understanding is that java treats arrays differently to other languages like c etc, so if i need to access x data i need to use:
// i have already read in the values from the dataset file to an int[40][40][40] array called data. for (i=0;i<int.length;i++){ for (j=0;i<int[i].length;j++){ out.println("x data = "+ data[0][i][j]; } }
And to access y variables held in this dataset
for (i=0;i<int.length;i++){ for (j=0;i<int[i].length;j++){ out.println("x data = "+ data[1][i][j]; } }
Similarly for z it must be data[2][i][j]
Is my understanding correct?
Or is it more like [x][y][z] access? i.e.
for (int i = 0; i < data.length; i++) { for (int j = 0; j < data.length; j++) { for (int k = 0; k < data.length; k++) { out.println("{" + i + ", " + j + ", " + k + "}=\t" + data[i][j][k]); count++; } } }
There is a dearth of material available when i searched for multi-dimensional arrays so pardon me if this is too beginner a question. Thanks for looking,>