I know how to sort an array by using the Arrays.sort() method of the array class but that only sorts it in ascending order. How do you sort in descending order?
Printable View
I know how to sort an array by using the Arrays.sort() method of the array class but that only sorts it in ascending order. How do you sort in descending order?
Since most of the sort() methods of the java.util.Arrays class sort there arguement in ascending order you probably will have to use the sort() method that take a Comparator as an arguement.
Could you please explain that a little better? Remember I'm a newbie at Java
Simple, u just sort it ascending and then make a
Code:public static void main(String[] args)
{
String xpto[] = {"01","02","03","04","05","06","07","08","09","10"};
for(int x=0;x<10;x++)
System.out.println(xpto[10 - 1 - x]);
}
Thanks for the help.