All pastes #223296 Raw Edit

Mine

public text v1 · immutable
#223296 ·published 2006-10-26 21:06 UTC
rendered paste body
import java.util.*;
import java.io.*;

public class IntSort {

   public static void main ( String[] args ) {

      int num=0;


      Scanner  input = new Scanner(System.in);
      Set<Integer> set = new TreeSet<Integer>(new DescendingIntCompartor());


      while( num!=-1) {

      System.out.print("Enter an integer: ");
      num=input.nextInt();
      set.add(num);
      }

      System.out.println(set);


   }
}



//the comparator class



import java.util.Comparator;

public class DescendingIntComparator implements Comparator<Integer> {

   public int compare(Integer blah1, Integer blah2) {
      if (blah1 > blah2 ) {
         return -1;
      }  else if (blah1 == blah2) {
         return 0;
      } else {
         return 1;
      }

   }
}