Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Supriya Kurian
Sort
1 Answer(s)      4 years and a month ago
Posted in : Java Beginners


program to sort a list of numbers in decendimg order


Advertisement
View Answers

December 7, 2010 at 10:50 AM


Hi Friend,

Try the following code:

import java.util.*;
class SortListInDescendingOrder{
    public static void main(String[] args) 
    {
        ArrayList<Integer> list=new ArrayList<Integer>();
        list.add(5);
        list.add(2);
        list.add(6);
        list.add(1);
        list.add(3);
        list.add(4);
        Collections.sort(list,Collections.reverseOrder());
        for(int i=0;i<list.size();i++){
            System.out.println(list.get(i));
        }

    }
}

Thanks



Related Tutorials/Questions & Answers:
Sort
Sort  program to sort a list of numbers in decendimg order   Hi Friend, Try the following code: import java.util.*; class SortListInDescendingOrder{ public static void main(String[] args
bubble sort
bubble sort  how to calculate the number of passes in bubble sort
Advertisements
insertion sort
insertion sort  how many arrays needed for insertion sort and why
bubble sort
bubble sort  write a program in java using bubble sort
insertion sort
insertion sort  write a program in java using insertion sort
insertion sort
insertion sort  write a program in java using insertion sort
insertion sort
insertion sort  write a program in java using insertion sort
insertion sort
insertion sort  write a program in java using insertion sort
Array sort
Array sort  Program that uses a function to sort an array of integers
buble sort
buble sort  ascending order by using Bubble sort programm   Java BubbleSort Example
SEARCH AND SORT
SEARCH AND SORT  Cam any one provide me the code in java that : Program to search for MAX,MIN and then SORT the set using any of the Divide and conquer method
quick sort
; System.out.println(" Quick Sort\n\n"); System.out.println("Values Before the sort:\n"); for(i = 0; i < array.length; i++){ array[i...("Values after the sort:\n"); for(i = 0; i <array.length; i
quick sort
; System.out.println(" Quick Sort\n\n"); System.out.println("Values Before the sort:\n"); for(i = 0; i < array.length; i++){ array[i...("Values after the sort:\n"); for(i = 0; i <array.length; i
quick sort
; System.out.println(" Quick Sort\n\n"); System.out.println("Values Before the sort:\n"); for(i = 0; i < array.length; i++){ array[i...("Values after the sort:\n"); for(i = 0; i <array.length; i
php array sort by value
php array sort by value  an example to sort the array by value
php array sort by key
php array sort by key  php script to sort array by key
php array sort by field
php array sort by field  Array sort by field in PHP
php array sort functions
php array sort functions  Sort function in php
insertion sort applet code
insertion sort applet code  i need Insertion Sort Applet Program
Insertion Sort Applet
Insertion Sort Applet  I need Insertion Sort Applet code was design by Dr. Daniel Liang Please
Insertion Sort Applet
Insertion Sort Applet  Please All , I need Insertion sort applet program
string array sort
string array sort  Hi. How to sort a string array
string array sort
string array sort  Hi. How to sort a string array
string array sort
string array sort  Hi. How to sort a string array
string array sort
string array sort  Hi. How to sort a string array
string array sort
string array sort  Hi. How to sort a string array
Insertion Sort Timer
Insertion Sort Timer  Welcome all I wanna program in java find the timer of insertion sort and find time complexity for random value thanks all
visualization Max-Heap-sort
visualization Max-Heap-sort  To Whom It May Concern, Would you please give the source code of applet Max-heap sort? I want to see the visualization of Max-Heap sort. Best Regards, saeideh
sort function - JSP-Servlet
sort function  How to sort a string variable in java   Hi friend, Please give in details and full source code to solve the problem. For information on java visit to : http://www.roseindia.net/java
bubble sort - Java Beginners
bubble sort  how to write program The bubble-sort algorithm in double...  Hi friend, Bubble Sort program : public class...[] = {10,5,3,89,110,120,1,8,2,12}; System.out.println("Values Before the sort:\n
Advertisements
 

 

 

DMCA.com