public static void main(String[] args) {
    	final long startTime = System.currentTimeMillis();
    	/*
    	if (args.length > 3 && !args[1].equals("-k") || args.length < 3) {
            System.err.println("Usage: [-DataCounter implementation] [-sorting routine] [filename of document to analyze]");
            System.exit(1);
        }*/

        // DataCounter implementation
        DataCounter<String> counter = null;
        if 		(args[0].equals("-b")) { counter = new BinarySearchTree<String>(new StringComparator()); }
        else if (args[0].equals("-a")) { counter = new AVLTree<String>(new StringComparator()); } 
        else if (args[0].equals("-m")) { counter = new MoveToFrontList<String>(new StringComparator()); }
        else if (args[0].equals("-h")) { counter = new HashTable<String>(new StringComparator(), new StringHasher()); } //implemented in phase B
        else { 
        	System.err.println("Must use -b (BinarySearchTree), -a (AVLTree), -m (MoveToFrontList), " +
        					   "or -h (HashTable) for argument 1.");
        	System.exit(1);
        }
        // Count the words and retrieve the array representation
        /*if(!args[1].equals("-k")){
        	countWords(args[2], counter); 
        }else{*/
        	countWords(args[3], counter);
        //}
        DataCount<String>[] counts = getCountsArray(counter);
        
        // Choose the sorting routine and sort
      /*  if (args.length == 3) {
	        if 		(args[1].equals("-is")) { Sorter.insertionSort(counts, new DataCountStringComparator()); }
	        else if (args[1].equals("-hs")) { Sorter.heapSort(counts, new DataCountStringComparator()); } 
	        else if (args[1].equals("-os")) { Sorter.otherSort(counts, new DataCountStringComparator()); }
	        else {
	        	System.err.println("Must use -is (Insertion sort), -hs (Heap sort), -os (Other sort)," +
	        					   " or -k <number> (Top-k sort) for argument 2.");
	        	System.exit(1);
	        }
        } else */if (args.length == 4) { //implemented in phase B
        	if (args[1].matches("-k")) { Sorter.topKSort(counts, new InverseDataComparator(), java.lang.Integer.parseInt(args[2])); } //implemented in phase B
	        else if (args[1].equals("-hs")) { Sorter.heapSort(counts, new DataCountStringComparator()); } 
        } else { 
        	System.err.println("Must use -is (Insertion sort), -hs (Heap sort), -os (Other sort)," +
        					   " or -k <number> (K-Sort) for argument 2.");
        	System.exit(1);
        }
        if(args[1].matches("-k")){
        	//printDataCountk(counts,java.lang.Integer.parseInt(args[2]));
        }else{
        	//printDataCount(counts);
        }
        printDataCountk(counts,java.lang.Integer.parseInt(args[2]));
        final long endTime = System.currentTimeMillis();
        System.out.println("Total execution time: " + (endTime - startTime) );
    }