Can you get an 2 dimensional array from 3 dimensional array without loops in Java? -
can subarray 3 dimensional array in java? i'm kind of new java , need help.
threedimensions[][][] = { { {false, true, false, false}, {false, true, false, false}, {false, true, false, false}, {false, true, false, false}, }, { {false, false, false, false}, {false, true, true, false}, {false, true, false, false}, {false, true, false, false}, } }; twodimensions = threedimensions[0];
this way doesn't work there way without looping?
your way work, you've got syntax bit wrong. should be
boolean[][][] threedimensions = { { {false, true, false, false}, {false, true, false, false}, {false, true, false, false}, {false, true, false, false}, }, { {false, false, false, false}, {false, true, true, false}, {false, true, false, false}, {false, true, false, false}, } }; boolean[][] twodimensions = threedimensions[0];
if problem printing out, need write
system.out.println(arrays.deeptostring(twodimensions));
Comments
Post a Comment