public static int countRows(final Region region, final Scan scan) throws IOException {
    try (InternalScanner scanner = region.getScanner(scan)) {
      return countRows(scanner);
    }
  }
Return the number of rows in the given table.
hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtil.java