Is there anyway to sort an array in reverse order? I tried using Arrays.sort() but this sorts in ascending order but can you do this for descending order?
It looks like it depends on what is in the array. If the elements of the array are primitives, then you're stuck. However, if they are Objects, then you can use sort(array, comparator), where comparator is an object that implements the Comparator interface, sorting it in whatever order you want. (This is all in the API docs for java.util.Arrays).
Or you could sort them (in ascending order) and then call the "Collections.reverse()" method to reverse them. [ADDED]This would require converting the Array to ArrayList, do the sort and "reverse()", and then convert it back to an Array. [ March 10, 2004: Message edited by: Wayne L Johnson ]
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.