Initializing Multidimentional Arrays
- by Eddy Freeman
Hi Guy,
I have a 3-multidimentional array :
int[][][] env;
which i would like to initialize with data in a text file. The data in the text file looks like this:
{ { { 0, 1,-1},
{ 0, 2,-1},
{-1,-1,-2},
{ 0, 0, 0} },
{ { 0, 0,-1},
{ 0, 0,-1},
{-1,-1,-2},
{ 0, 0, 0} }
}
Actually the accolades can be removed and replaced with different characters if it is necessary. If there are any better way to format the values in the text file, then it is welcomed.
I am looking for the best way to initialize the array in the java program with the values from the text file.
All your help is appreciated.
Thanks.