public int countRows(final Region region, final Scan scan) throws IOException {
    InternalScanner scanner = region.getScanner(scan);
    try {
      return countRows(scanner);
    } finally {
      scanner.close();
    }
  }
Return the number of rows in the given table.
hbase-testing-util/src/main/java/org/apache/hadoop/hbase/HBaseTestingUtility.java