public static int countRows(final InternalScanner scanner) throws IOException {
    int scannedCount = 0;
    List<Cell> results = new ArrayList<>();
    boolean hasMore = true;
    while (hasMore) {
      hasMore = scanner.next(results);
      scannedCount += results.size();
      results.clear();
    }
    return scannedCount;
  }
Return the number of rows in the given table.
hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtil.java