import java.io.*;
import java.util.*;
/**
* This program takes in a file with integers and sorts it with heapsort
*/
public class HeapSort {
/**
* main method
*/
public static void main (String[] args) {
if( args.length != 1) {
System.err.println("Usage: java HeapSort filename");
System.exit(0);
} else {
Scanner input=null;
int[] items;
ArrayList list = new ArrayList();
try {
input = new Scanner(new File(args[0]));
} catch(FileNotFoundException fnf) {
System.err.println(fnf);
}
while(input.hasNext()) {
list.add(input.nextInt());
}
input.close();
items = new int[list.size()];
list.toArray(items);
}
}
} //HeapSort