Here you can find the source of printMatrix(boolean[][] matrix)
public static void printMatrix(boolean[][] matrix)
//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'); } } }