code: public static int run(Configuration conf, Tool tool, String[] args) 
      throws Exception{
      if(conf == null) {
        conf = new Configuration();
      }
      GenericOptionsParser parser = new GenericOptionsParser(conf, args);
      //set the configuration back, so that Tool can configure itself
      tool.setConf(conf);
      
      //get the args w/o generic hadoop args
      String[] toolArgs = parser.getRemainingArgs();
      return tool.run(toolArgs);
    }
docs: Runs the given <code>Tool</code> by {@link Tool#run(String[])}, after
  parsing with the given generic arguments. Uses the given
  <code>Configuration</code>, or builds one if null.
  
  Sets the <code>Tool</code>'s configuration with the possibly modified
  version of the <code>conf</code>.
  
  @param conf <code>Configuration</code> for the <code>Tool</code>.
  @param tool <code>Tool</code> to run.
  @param args command-line arguments to the tool.
  @return exit code of the {@link Tool#run(String[])} method.