Saturday 22 May 2010

Sorting DecendingOrder by Using TreeSet Collection

import java.util.*;

public class SortingDescending {
  @SuppressWarnings("unchecked")
    public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    int[] num = new int [10];
    int count = 0;
while(count< num.length){
      num[count]= input.nextInt();
      ++count;
     }
    TreeSet tree = new TreeSet()      ;  

for(int i = 0; i < num.length; i++){
tree.add(num[i])        ;
      }
System.out.println (" The numbers of the array in descrending order are: " +  tree.descendingSet() );
   }
}
OtterBox Defender Case for iPhone 3G, 3G S (Black)

1 comment:

  1. Thanks a lot for sharing and I have some special things for you. If you are in free time. Read and ponder the good quotes of life below, you will surely draw in life's own deep lessons.sunny day quotes and or you can relax by playing the game after the tired working timemotorcycle racing games You can relax by reading the stories as ngôn tình hiện đại hay nhất. Each article definitely sexmang to give you the most comfortable feeling. Enjoy the experience!

    ReplyDelete