Sorts the specified range of the array into ascending order. The range
to be sorted extends from the index fromIndex, inclusive, to
the index toIndex, exclusive. If fromIndex == toIndex,
the range to be sorted is empty.
Implementation note: The sorting algorithm is a Dual-Pivot Quicksort by Vladimir Yaroslavskiy, Jon Bentley, and Joshua Bloch. This algorithm offers O(n log(n)) performance on many data sets that cause other quicksorts to degrade to quadratic performance, and is typically faster than traditional (one-pivot) Quicksort implementations.
a | the array to be sorted | |
fromIndex | the index of the first element, inclusive, to be sorted | |
toIndex | the index of the last element, exclusive, to be sorted |
IllegalArgumentException | if fromIndex > toIndex | |
ArrayIndexOutOfBoundsException
| if fromIndex < 0 or toIndex > a.length |
Diagram: Arrays