I know how to sort arrays in ascending order by using API's sort method, I want to know how to sort arrays in descending order by using API's method. For your information, i want to mention that i know how to sort arrays in descending order through manually.
Any suggestions will be appreciated. Thanks in Advanced.........
Joined: Oct 13, 2005
Create a Comparator which returns negative numbers for "greater" and positive numbers for "smaller."
Sort in the usual fashion and reverse the array.
Joined: Jun 14, 2008
have a look at the reverseOrder() and reverseOrder(Comparator) methods on the Collections class.
They allow you to create a reverse order comparator based upon either the natural order of the objects or the supplied comparator depending upon which you choose. Have a look at the Collections java docs for more info.