public static void main(String[] args) throws Exception {
    Configuration conf = HBaseConfig.Instance().getConfiguration();

    // parse user input
    Options opt = new Options();
    opt.addOption(
        OptionBuilder.withArgName("property=value")
            .hasArg()
            .withDescription("Override HBase Configuration Settings")
            .create("D"));
    CommandLine cmd = new GnuParser().parse(opt, args);

    if (cmd.hasOption("D")) {
      for (String confOpt : cmd.getOptionValues("D")) {
        String[] kv = confOpt.split("=", 2);
        if (kv.length == 2) {
          conf.set(kv[0], kv[1]);
          LOG.debug("-D configuration override: " + kv[0] + "=" + kv[1]);
        } else {
          throw new ParseException("-D option format invalid: " + confOpt);
        }
      }
    }

    if (1 != cmd.getArgList().size() || cmd.hasOption("h")) {
      new HelpFormatter().printHelp("TableRegionScanner [ options ] <TABLE>", opt);
      return;
    }

    String tableName = cmd.getArgs()[0];

    HTable table = new HTable(conf, tableName);
    HBaseAdmin admin = new HBaseAdmin(conf);
    Map<String, HRegionContent> regionMap = getRegionMap(table, admin);

    int count = 0;
    int fileSize = 0;
    for (HRegionContent rc : regionMap.values()) {
      count++;
      fileSize += rc.getTotalSizeMB();
    }

    System.out.println("region map size: " + regionMap.size());
    System.out.println("file size :" + fileSize);
  }