Labels

Thursday, March 13, 2014

JAVA 3D Array Print Use FOR loop

JAVA 3D Array Print Use FOR loop


public class Exercise1 {
    public static void main(String[] args) throws Exception {
double[][][] numbers = new double[][][] {
   {
{  12.44, 525.38,  -6.28,  2448.32, 632.04 },
{-378.05,  48.14, 634.18,   762.48,  83.02 },
{  64.92,  -7.44,  86.74,  -534.60, 386.73 }
   },
   {
{  48.02, 120.44,   38.62,  526.82, 1704.62 },
{  56.85, 105.48,  363.31,  172.62,  128.48 },
{  906.68, 47.12, -166.07, 4444.26,  408.62 }
   }
};

       for (int i=0; i < 3; i++){
for (int j=0;j<5;j++){
for (int k=0;k<2;k++){
System.out.println(numbers[k][i][j]+" ");
}       }           }
}        }

No comments:

Post a Comment