Sorting, indexing and ranking in Java.