public static void printErIntArray(int[][] matrix){
for (int i = 0; i < matrix.length; i++) { //this equals to the row in our matrix.
for (int j = 0; j < matrix[i].length; j++) { //this equals to the column in each row.
System.out.println(matrix[i][j] + " ");
}
// System.out.println("/t"); //change line on console as row comes to end in the matrix.
}
}
public static void printErIntArrayByStream(int[][] iDim) {
Arrays.stream(iDim).forEach(i -> {
Arrays.stream(i).forEach(n -> System.out.println(n));
System.out.println();
});
}
public static void printErFloatArray(float[][] matrix){
for (int i = 0; i < matrix.length; i++) { //this equals to the row in our matrix.
for (int j = 0; j < matrix[i].length; j++) { //this equals to the column in each row.
System.out.println(matrix[i][j] + " ");
}
// System.out.println("/t"); //change line on console as row comes to end in the matrix.
}
}
public static void printErDoubleArrayByStream(double[][] matrix){
Arrays.stream(matrix).forEach(i -> {
Arrays.stream(i).forEach(n -> System.out.format(Locale.US,"%.2f ", n));
System.out.println();
});
}
public static void printThreeIntArray(int[][][] arr){
for(int i=0;i<arr.length;i++) {
for(int j=0;j<arr[i].length;j++) { //我们可以把前边想像成一个一维数组
if(j==arr[i].length-1) {
System.out.println(); //换行
}
for(int k=0;k<arr[i][j].length;k++)
System.out.print(arr[i][j][k]+" ");//遍历三维数组
}
}
}
public static void printThreeFloatArray(float[][][] arr){
for(int i=0;i<arr.length;i++) {
for(int j=0;j<arr[i].length;j++) { //我们可以把前边想像成一个一维数组
if(j==arr[i].length-1) {
System.out.println(); //换行
}
for(int k=0;k<arr[i][j].length;k++)
System.out.print(arr[i][j][k]+" ");//遍历三维数组
}
}
}