Java Matrix Print printMatrix(boolean[][] matrix)

Here you can find the source of printMatrix(boolean[][] matrix)

Description

print Matrix

License

Apache License

Declaration

public static void printMatrix(boolean[][] matrix) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static void printMatrix(boolean[][] matrix) {
        if (matrix == null) {
            return;
        }/*  ww  w.jav  a2  s .c  o m*/
        int m = matrix.length;
        if (m == 0) {
            return;
        }
        int n = matrix[0].length;
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                System.out.print(" " + (matrix[i][j] ? 1 : 0));
            }
            System.out.print('\n');
        }
    }
}

Related

  1. print2DIntArray(int[][] array)
  2. print2DIntArray(int[][] nums)
  3. printMatrix(byte[][] matrix)
  4. printMatrix(byte[][] matrix, boolean printMatrix)
  5. printMatrix(double data[][])
  6. printMatrix(double[] a, String label)