class Foo implements Comparable<Foo> {

    int cost;
    
    public Foo(int c) { cost = c;}

    public int compareTo(Foo other) {

	if (cost < other.cost) return -1;
        if (cost == other.cost) return 0;
        return 1;
    }

    public static void main(String [] args) {

	Foo [] arr = new Foo[4];
        arr[0] = new Foo(12);
        arr[1] = new Foo(4);
        arr[2] = new Foo(16);
        arr[3] = new Foo(8);

        java.util.Arrays.sort(arr);

        for (int i = 0; i < arr.length; i++)
	    System.out.println(arr[i].cost);
    }
 

}