String[] array = { "One", "Two", "Three", "Four", "Fight" };
Arrays.sort( array, Collections.reverseOrder() );
System.out.println( Arrays.toString( array ) );
For descending sorting use comparator Collections.reverseOrder().Output is:
[Two, Three, One, Four, Fight]
No comments:
Post a Comment