Here you can find the source of sumCols(boolean[][] inputMatrix)
static public int[] sumCols(boolean[][] inputMatrix)
//package com.java2s; //License from project: Open Source License public class Main { static public int[] sumCols(boolean[][] inputMatrix) { int g = inputMatrix.length; int m = inputMatrix[0].length; int[] sumMatrix = new int[m]; int i;/*from ww w . jav a 2 s . com*/ for (int j = 0; j < m; j++) { sumMatrix[j] = 0; for (i = 0; i < g; i++) { if (inputMatrix[i][j]) sumMatrix[j]++; } } return sumMatrix; } }