Here you can find the source of matrixIsWellformed(int numLabels, int[][] matrix)
public static boolean matrixIsWellformed(int numLabels, int[][] matrix)
//package com.java2s; //License from project: Apache License public class Main { public static boolean matrixIsWellformed(int numLabels, int[][] matrix) { boolean isWellformed = true; if (matrix.length != numLabels) { isWellformed = false;// w w w .j av a 2s .c o m } for (int[] gold : matrix) { if (gold.length != numLabels) { isWellformed = false; } for (int pred : gold) { if (pred < 0) { isWellformed = false; } } } return isWellformed; } }