Why
long t = System.currentTimeMillis();
int size = 3333333;
int[][][] arr = new int[size][6][2];
// int[][][] arr= new int[2][6][size];
pr(System.currentTimeMillis() - t );
prints 5000 ms
but
long t = System.currentTimeMillis();
int size = 3333333;
// int[][][] arr = new int[size][6][2];
int[][][] arr= new int[2][6][size];
pr(System.currentTimeMillis() - t );
prints 44 ms
Second solution 115 time faster