public static void main(String[] args) {

        // Command line options
        cmdOptions = new Options();
        cmdOptions.addOption("k", true, "Top k parameter");
        cmdOptions.addOption("m", true, "Number of reduces");
        cmdOptions.addOption("s", false, "Use hadoop sequence file");
        cmdOptions.addOption("i", "input", true, "Input");
        cmdOptions.addOption("o", "output", true, "Output");

        CommandLineParser parser = new PosixParser();
        try {
            CommandLine cmd = parser.parse(cmdOptions, args);

            if (cmd.hasOption('k') && cmd.hasOption('m') && cmd.hasOption('i')
                    && cmd.hasOption('o')) {
                Integer k = Integer.valueOf(cmd.getOptionValue('k'));
                Integer m = Integer.valueOf(cmd.getOptionValue('m'));
                String inputFolder = cmd.getOptionValue('i');
                String outputFolder = cmd.getOptionValue('o');
                Boolean useSequenceFile = cmd.hasOption('s');

                TopKBruteForceApp app = new TopKBruteForceApp(k, m,
                        inputFolder, outputFolder, useSequenceFile);
                try {
                    app.runJobs();
                } catch (Exception e) {
                    e.printStackTrace();
                    System.exit(3);
                }
                return;
            }

            TopKBruteForceApp.printCommandHelp();

        } catch (ParseException exp) {
            // something went wrong
            System.err.println("Wrong parameters" + exp.getMessage());
            printCommandHelp();
        }
    }