java.util
Class Arrays

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.util.Arrays

public class Arrays
extends Object sample code for java.lang.Object definition code for java.lang.Object

This class contains various methods for manipulating arrays (such as sorting and searching). This class also contains a static factory that allows arrays to be viewed as lists.

The methods in this class all throw a NullPointerException if the specified array reference is null, except where noted.

The documentation for the methods contained in this class includes briefs description of the implementations. Such descriptions should be regarded as implementation notes, rather than parts of the specification. Implementors should feel free to substitute other algorithms, so long as the specification itself is adhered to. (For example, the algorithm used by sort(Object[]) does not have to be a mergesort, but it does have to be stable.)

This class is a member of the Java Collections Framework.

Since:
1.2
See Also:
Comparable sample code for java.lang.Comparable definition code for java.lang.Comparable , Comparator sample code for java.util.Comparator definition code for java.util.Comparator

Method Summary
static
<T> List sample code for java.util.List definition code for java.util.List <T>
asList sample code for java.util.Arrays.asList(T...) definition code for java.util.Arrays.asList(T...) (T... a)
          Returns a fixed-size list backed by the specified array.
static int binarySearch sample code for java.util.Arrays.binarySearch(byte[], byte) definition code for java.util.Arrays.binarySearch(byte[], byte) (byte[] a, byte key)
          Searches the specified array of bytes for the specified value using the binary search algorithm.
static int binarySearch sample code for java.util.Arrays.binarySearch(char[], char) definition code for java.util.Arrays.binarySearch(char[], char) (char[] a, char key)
          Searches the specified array of chars for the specified value using the binary search algorithm.
static int binarySearch sample code for java.util.Arrays.binarySearch(double[], double) definition code for java.util.Arrays.binarySearch(double[], double) (double[] a, double key)
          Searches the specified array of doubles for the specified value using the binary search algorithm.
static int binarySearch sample code for java.util.Arrays.binarySearch(float[], float) definition code for java.util.Arrays.binarySearch(float[], float) (float[] a, float key)
          Searches the specified array of floats for the specified value using the binary search algorithm.
static int binarySearch sample code for java.util.Arrays.binarySearch(int[], int) definition code for java.util.Arrays.binarySearch(int[], int) (int[] a, int key)
          Searches the specified array of ints for the specified value using the binary search algorithm.
static int binarySearch sample code for java.util.Arrays.binarySearch(long[], long) definition code for java.util.Arrays.binarySearch(long[], long) (long[] a, long key)
          Searches the specified array of longs for the specified value using the binary search algorithm.
static int binarySearch sample code for java.util.Arrays.binarySearch(java.lang.Object[], java.lang.Object) definition code for java.util.Arrays.binarySearch(java.lang.Object[], java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object [] a, Object sample code for java.lang.Object definition code for java.lang.Object  key)
          Searches the specified array for the specified object using the binary search algorithm.
static int binarySearch sample code for java.util.Arrays.binarySearch(short[], short) definition code for java.util.Arrays.binarySearch(short[], short) (short[] a, short key)
          Searches the specified array of shorts for the specified value using the binary search algorithm.
static
<T> int
binarySearch sample code for java.util.Arrays.binarySearch(T[], T, java.util.Comparator) definition code for java.util.Arrays.binarySearch(T[], T, java.util.Comparator) (T[] a, T key, Comparator sample code for java.util.Comparator definition code for java.util.Comparator <? super T> c)
          Searches the specified array for the specified object using the binary search algorithm.
static boolean deepEquals sample code for java.util.Arrays.deepEquals(java.lang.Object[], java.lang.Object[]) definition code for java.util.Arrays.deepEquals(java.lang.Object[], java.lang.Object[]) (Object sample code for java.lang.Object definition code for java.lang.Object [] a1, Object sample code for java.lang.Object definition code for java.lang.Object [] a2)
          Returns true if the two specified arrays are deeply equal to one another.
static int deepHashCode sample code for java.util.Arrays.deepHashCode(java.lang.Object[]) definition code for java.util.Arrays.deepHashCode(java.lang.Object[]) (Object sample code for java.lang.Object definition code for java.lang.Object [] a)
          Returns a hash code based on the "deep contents" of the specified array.
static String sample code for java.lang.String definition code for java.lang.String deepToString sample code for java.util.Arrays.deepToString(java.lang.Object[]) definition code for java.util.Arrays.deepToString(java.lang.Object[]) (Object sample code for java.lang.Object definition code for java.lang.Object [] a)
          Returns a string representation of the "deep contents" of the specified array.
static boolean equals sample code for java.util.Arrays.equals(boolean[], boolean[]) definition code for java.util.Arrays.equals(boolean[], boolean[]) (boolean[] a, boolean[] a2)
          Returns true if the two specified arrays of booleans are equal to one another.
static boolean equals sample code for java.util.Arrays.equals(byte[], byte[]) definition code for java.util.Arrays.equals(byte[], byte[]) (byte[] a, byte[] a2)
          Returns true if the two specified arrays of bytes are equal to one another.
static boolean equals sample code for java.util.Arrays.equals(char[], char[]) definition code for java.util.Arrays.equals(char[], char[]) (char[] a, char[] a2)
          Returns true if the two specified arrays of chars are equal to one another.
static boolean equals sample code for java.util.Arrays.equals(double[], double[]) definition code for java.util.Arrays.equals(double[], double[]) (double[] a, double[] a2)
          Returns true if the two specified arrays of doubles are equal to one another.
static boolean equals sample code for java.util.Arrays.equals(float[], float[]) definition code for java.util.Arrays.equals(float[], float[]) (float[] a, float[] a2)
          Returns true if the two specified arrays of floats are equal to one another.
static boolean equals sample code for java.util.Arrays.equals(int[], int[]) definition code for java.util.Arrays.equals(int[], int[]) (int[] a, int[] a2)
          Returns true if the two specified arrays of ints are equal to one another.
static boolean equals sample code for java.util.Arrays.equals(long[], long[]) definition code for java.util.Arrays.equals(long[], long[]) (long[] a, long[] a2)
          Returns true if the two specified arrays of longs are equal to one another.
static boolean equals sample code for java.util.Arrays.equals(java.lang.Object[], java.lang.Object[]) definition code for java.util.Arrays.equals(java.lang.Object[], java.lang.Object[]) (Object sample code for java.lang.Object definition code for java.lang.Object [] a, Object sample code for java.lang.Object definition code for java.lang.Object [] a2)
          Returns true if the two specified arrays of Objects are equal to one another.
static boolean equals sample code for java.util.Arrays.equals(short[], short[]) definition code for java.util.Arrays.equals(short[], short[]) (short[] a, short[] a2)
          Returns true if the two specified arrays of shorts are equal to one another.
static void fill sample code for java.util.Arrays.fill(boolean[], boolean) definition code for java.util.Arrays.fill(boolean[], boolean) (boolean[] a, boolean val)
          Assigns the specified boolean value to each element of the specified array of booleans.
static void fill sample code for java.util.Arrays.fill(boolean[], int, int, boolean) definition code for java.util.Arrays.fill(boolean[], int, int, boolean) (boolean[] a, int fromIndex, int toIndex, boolean val)
          Assigns the specified boolean value to each element of the specified range of the specified array of booleans.
static void fill sample code for java.util.Arrays.fill(byte[], byte) definition code for java.util.Arrays.fill(byte[], byte) (byte[] a, byte val)
          Assigns the specified byte value to each element of the specified array of bytes.
static void fill sample code for java.util.Arrays.fill(byte[], int, int, byte) definition code for java.util.Arrays.fill(byte[], int, int, byte) (byte[] a, int fromIndex, int toIndex, byte val)
          Assigns the specified byte value to each element of the specified range of the specified array of bytes.
static void fill sample code for java.util.Arrays.fill(char[], char) definition code for java.util.Arrays.fill(char[], char) (char[] a, char val)
          Assigns the specified char value to each element of the specified array of chars.
static void fill sample code for java.util.Arrays.fill(char[], int, int, char) definition code for java.util.Arrays.fill(char[], int, int, char) (char[] a, int fromIndex, int toIndex, char val)
          Assigns the specified char value to each element of the specified range of the specified array of chars.
static void fill sample code for java.util.Arrays.fill(double[], double) definition code for java.util.Arrays.fill(double[], double) (double[] a, double val)
          Assigns the specified double value to each element of the specified array of doubles.
static void fill sample code for java.util.Arrays.fill(double[], int, int, double) definition code for java.util.Arrays.fill(double[], int, int, double) (double[] a, int fromIndex, int toIndex, double val)
          Assigns the specified double value to each element of the specified range of the specified array of doubles.
static void fill sample code for java.util.Arrays.fill(float[], float) definition code for java.util.Arrays.fill(float[], float) (float[] a, float val)
          Assigns the specified float value to each element of the specified array of floats.
static void fill sample code for java.util.Arrays.fill(float[], int, int, float) definition code for java.util.Arrays.fill(float[], int, int, float) (float[] a, int fromIndex, int toIndex, float val)
          Assigns the specified float value to each element of the specified range of the specified array of floats.
static void fill sample code for java.util.Arrays.fill(int[], int) definition code for java.util.Arrays.fill(int[], int) (int[] a, int val)
          Assigns the specified int value to each element of the specified array of ints.
static void fill sample code for java.util.Arrays.fill(int[], int, int, int) definition code for java.util.Arrays.fill(int[], int, int, int) (int[] a, int fromIndex, int toIndex, int val)
          Assigns the specified int value to each element of the specified range of the specified array of ints.
static void fill sample code for java.util.Arrays.fill(long[], int, int, long) definition code for java.util.Arrays.fill(long[], int, int, long) (long[] a, int fromIndex, int toIndex, long val)
          Assigns the specified long value to each element of the specified range of the specified array of longs.
static void fill sample code for java.util.Arrays.fill(long[], long) definition code for java.util.Arrays.fill(long[], long) (long[] a, long val)
          Assigns the specified long value to each element of the specified array of longs.
static void fill sample code for java.util.Arrays.fill(java.lang.Object[], int, int, java.lang.Object) definition code for java.util.Arrays.fill(java.lang.Object[], int, int, java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object [] a, int fromIndex, int toIndex, Object sample code for java.lang.Object definition code for java.lang.Object  val)
          Assigns the specified Object reference to each element of the specified range of the specified array of Objects.
static void fill sample code for java.util.Arrays.fill(java.lang.Object[], java.lang.Object) definition code for java.util.Arrays.fill(java.lang.Object[], java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object [] a, Object sample code for java.lang.Object definition code for java.lang.Object  val)
          Assigns the specified Object reference to each element of the specified array of Objects.
static void fill sample code for java.util.Arrays.fill(short[], int, int, short) definition code for java.util.Arrays.fill(short[], int, int, short) (short[] a, int fromIndex, int toIndex, short val)
          Assigns the specified short value to each element of the specified range of the specified array of shorts.
static void fill sample code for java.util.Arrays.fill(short[], short) definition code for java.util.Arrays.fill(short[], short) (short[] a, short val)
          Assigns the specified short value to each element of the specified array of shorts.
static int hashCode sample code for java.util.Arrays.hashCode(boolean[]) definition code for java.util.Arrays.hashCode(boolean[]) (boolean[] a)
          Returns a hash code based on the contents of the specified array.
static int hashCode sample code for java.util.Arrays.hashCode(byte[]) definition code for java.util.Arrays.hashCode(byte[]) (byte[] a)
          Returns a hash code based on the contents of the specified array.
static int hashCode sample code for java.util.Arrays.hashCode(char[]) definition code for java.util.Arrays.hashCode(char[]) (char[] a)
          Returns a hash code based on the contents of the specified array.
static int hashCode sample code for java.util.Arrays.hashCode(double[]) definition code for java.util.Arrays.hashCode(double[]) (double[] a)
          Returns a hash code based on the contents of the specified array.
static int hashCode sample code for java.util.Arrays.hashCode(float[]) definition code for java.util.Arrays.hashCode(float[]) (float[] a)
          Returns a hash code based on the contents of the specified array.
static int hashCode sample code for java.util.Arrays.hashCode(int[]) definition code for java.util.Arrays.hashCode(int[]) (int[] a)
          Returns a hash code based on the contents of the specified array.
static int hashCode sample code for java.util.Arrays.hashCode(long[]) definition code for java.util.Arrays.hashCode(long[]) (long[] a)
          Returns a hash code based on the contents of the specified array.
static int hashCode sample code for java.util.Arrays.hashCode(java.lang.Object[]) definition code for java.util.Arrays.hashCode(java.lang.Object[]) (Object sample code for java.lang.Object definition code for java.lang.Object [] a)
          Returns a hash code based on the contents of the specified array.
static int hashCode sample code for java.util.Arrays.hashCode(short[]) definition code for java.util.Arrays.hashCode(short[]) (short[] a)
          Returns a hash code based on the contents of the specified array.
static void sort sample code for java.util.Arrays.sort(byte[]) definition code for java.util.Arrays.sort(byte[]) (byte[] a)
          Sorts the specified array of bytes into ascending numerical order.
static void sort sample code for java.util.Arrays.sort(byte[], int, int) definition code for java.util.Arrays.sort(byte[], int, int) (byte[] a, int fromIndex, int toIndex)
          Sorts the specified range of the specified array of bytes into ascending numerical order.
static void sort sample code for java.util.Arrays.sort(char[]) definition code for java.util.Arrays.sort(char[]) (char[] a)
          Sorts the specified array of chars into ascending numerical order.
static void sort sample code for java.util.Arrays.sort(char[], int, int) definition code for java.util.Arrays.sort(char[], int, int) (char[] a, int fromIndex, int toIndex)
          Sorts the specified range of the specified array of chars into ascending numerical order.
static void sort sample code for java.util.Arrays.sort(double[]) definition code for java.util.Arrays.sort(double[]) (double[] a)
          Sorts the specified array of doubles into ascending numerical order.
static void sort sample code for java.util.Arrays.sort(double[], int, int) definition code for java.util.Arrays.sort(double[], int, int) (double[] a, int fromIndex, int toIndex)
          Sorts the specified range of the specified array of doubles into ascending numerical order.
static void sort sample code for java.util.Arrays.sort(float[]) definition code for java.util.Arrays.sort(float[]) (float[] a)
          Sorts the specified array of floats into ascending numerical order.
static void sort sample code for java.util.Arrays.sort(float[], int, int) definition code for java.util.Arrays.sort(float[], int, int) (float[] a, int fromIndex, int toIndex)
          Sorts the specified range of the specified array of floats into ascending numerical order.
static void sort sample code for java.util.Arrays.sort(int[]) definition code for java.util.Arrays.sort(int[]) (int[] a)
          Sorts the specified array of ints into ascending numerical order.
static void sort sample code for java.util.Arrays.sort(int[], int, int) definition code for java.util.Arrays.sort(int[], int, int) (int[] a, int fromIndex, int toIndex)
          Sorts the specified range of the specified array of ints into ascending numerical order.
static void sort sample code for java.util.Arrays.sort(long[]) definition code for java.util.Arrays.sort(long[]) (long[] a)
          Sorts the specified array of longs into ascending numerical order.
static void sort sample code for java.util.Arrays.sort(long[], int, int) definition code for java.util.Arrays.sort(long[], int, int) (long[] a, int fromIndex, int toIndex)
          Sorts the specified range of the specified array of longs into ascending numerical order.
static void sort sample code for java.util.Arrays.sort(java.lang.Object[]) definition code for java.util.Arrays.sort(java.lang.Object[]) (Object sample code for java.lang.Object definition code for java.lang.Object [] a)
          Sorts the specified array of objects into ascending order, according to the natural ordering of its elements.
static void sort sample code for java.util.Arrays.sort(java.lang.Object[], int, int) definition code for java.util.Arrays.sort(java.lang.Object[], int, int) (Object sample code for java.lang.Object definition code for java.lang.Object [] a, int fromIndex, int toIndex)
          Sorts the specified range of the specified array of objects into ascending order, according to the natural ordering of its elements.
static void sort sample code for java.util.Arrays.sort(short[]) definition code for java.util.Arrays.sort(short[]) (short[] a)
          Sorts the specified array of shorts into ascending numerical order.
static void sort sample code for java.util.Arrays.sort(short[], int, int) definition code for java.util.Arrays.sort(short[], int, int) (short[] a, int fromIndex, int toIndex)
          Sorts the specified range of the specified array of shorts into ascending numerical order.
static
<T> void
sort sample code for java.util.Arrays.sort(T[], java.util.Comparator) definition code for java.util.Arrays.sort(T[], java.util.Comparator) (T[] a, Comparator sample code for java.util.Comparator definition code for java.util.Comparator <? super T> c)
          Sorts the specified array of objects according to the order induced by the specified comparator.
static
<T> void
sort sample code for java.util.Arrays.sort(T[], int, int, java.util.Comparator) definition code for java.util.Arrays.sort(T[], int, int, java.util.Comparator) (T[] a, int fromIndex, int toIndex, Comparator sample code for java.util.Comparator definition code for java.util.Comparator <? super T> c)
          Sorts the specified range of the specified array of objects according to the order induced by the specified comparator.
static String sample code for java.lang.String definition code for java.lang.String toString sample code for java.util.Arrays.toString(boolean[]) definition code for java.util.Arrays.toString(boolean[]) (boolean[] a)
          Returns a string representation of the contents of the specified array.
static String sample code for java.lang.String definition code for java.lang.String toString sample code for java.util.Arrays.toString(byte[]) definition code for java.util.Arrays.toString(byte[]) (byte[] a)
          Returns a string representation of the contents of the specified array.
static String sample code for java.lang.String definition code for java.lang.String toString sample code for java.util.Arrays.toString(char[]) definition code for java.util.Arrays.toString(char[]) (char[] a)
          Returns a string representation of the contents of the specified array.
static String sample code for java.lang.String definition code for java.lang.String toString sample code for java.util.Arrays.toString(double[]) definition code for java.util.Arrays.toString(double[]) (double[] a)
          Returns a string representation of the contents of the specified array.
static String sample code for java.lang.String definition code for java.lang.String toString sample code for java.util.Arrays.toString(float[]) definition code for java.util.Arrays.toString(float[]) (float[] a)
          Returns a string representation of the contents of the specified array.
static String sample code for java.lang.String definition code for java.lang.String toString sample code for java.util.Arrays.toString(int[]) definition code for java.util.Arrays.toString(int[]) (int[] a)
          Returns a string representation of the contents of the specified array.
static String sample code for java.lang.String definition code for java.lang.String toString sample code for java.util.Arrays.toString(long[]) definition code for java.util.Arrays.toString(long[]) (long[] a)
          Returns a string representation of the contents of the specified array.
static String sample code for java.lang.String definition code for java.lang.String toString sample code for java.util.Arrays.toString(java.lang.Object[]) definition code for java.util.Arrays.toString(java.lang.Object[]) (Object sample code for java.lang.Object definition code for java.lang.Object [] a)
          Returns a string representation of the contents of the specified array.
static String sample code for java.lang.String definition code for java.lang.String toString sample code for java.util.Arrays.toString(short[]) definition code for java.util.Arrays.toString(short[]) (short[] a)
          Returns a string representation of the contents of the specified array.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Method Detail

sort sample code for java.util.Arrays.sort(long[]) definition code for java.util.Arrays.sort(long[])

public static void sort(long[] a)
Sorts the specified array of longs into ascending numerical order. The sorting algorithm is a tuned quicksort, adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a Sort Function", Software-Practice and Experience, Vol. 23(11) P. 1249-1265 (November 1993). This algorithm offers n*log(n) performance on many data sets that cause other quicksorts to degrade to quadratic performance.

Parameters:
a - the array to be sorted.

sort sample code for java.util.Arrays.sort(long[], int, int) definition code for java.util.Arrays.sort(long[], int, int)

public static void sort(long[] a,
                        int fromIndex,
                        int toIndex)
Sorts the specified range of the specified array of longs into ascending numerical order. The range to be sorted extends from index fromIndex, inclusive, to index toIndex, exclusive. (If fromIndex==toIndex, the range to be sorted is empty.)

The sorting algorithm is a tuned quicksort, adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a Sort Function", Software-Practice and Experience, Vol. 23(11) P. 1249-1265 (November 1993). This algorithm offers n*log(n) performance on many data sets that cause other quicksorts to degrade to quadratic performance.

Parameters:
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.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if fromIndex > toIndex
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if fromIndex < 0 or toIndex > a.length

sort sample code for java.util.Arrays.sort(int[]) definition code for java.util.Arrays.sort(int[])

public static void sort(int[] a)
Sorts the specified array of ints into ascending numerical order. The sorting algorithm is a tuned quicksort, adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a Sort Function", Software-Practice and Experience, Vol. 23(11) P. 1249-1265 (November 1993). This algorithm offers n*log(n) performance on many data sets that cause other quicksorts to degrade to quadratic performance.

Parameters:
a - the array to be sorted.

sort sample code for java.util.Arrays.sort(int[], int, int) definition code for java.util.Arrays.sort(int[], int, int)

public static void sort(int[] a,
                        int fromIndex,
                        int toIndex)
Sorts the specified range of the specified array of ints into ascending numerical order. The range to be sorted extends from index fromIndex, inclusive, to index toIndex, exclusive. (If fromIndex==toIndex, the range to be sorted is empty.)

The sorting algorithm is a tuned quicksort, adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a Sort Function", Software-Practice and Experience, Vol. 23(11) P. 1249-1265 (November 1993). This algorithm offers n*log(n) performance on many data sets that cause other quicksorts to degrade to quadratic performance.

Parameters:
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.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if fromIndex > toIndex
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if fromIndex < 0 or toIndex > a.length

sort sample code for java.util.Arrays.sort(short[]) definition code for java.util.Arrays.sort(short[])

public static void sort(short[] a)
Sorts the specified array of shorts into ascending numerical order. The sorting algorithm is a tuned quicksort, adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a Sort Function", Software-Practice and Experience, Vol. 23(11) P. 1249-1265 (November 1993). This algorithm offers n*log(n) performance on many data sets that cause other quicksorts to degrade to quadratic performance.

Parameters:
a - the array to be sorted.

sort sample code for java.util.Arrays.sort(short[], int, int) definition code for java.util.Arrays.sort(short[], int, int)

public static void sort(short[] a,
                        int fromIndex,
                        int toIndex)
Sorts the specified range of the specified array of shorts into ascending numerical order. The range to be sorted extends from index fromIndex, inclusive, to index toIndex, exclusive. (If fromIndex==toIndex, the range to be sorted is empty.)

The sorting algorithm is a tuned quicksort, adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a Sort Function", Software-Practice and Experience, Vol. 23(11) P. 1249-1265 (November 1993). This algorithm offers n*log(n) performance on many data sets that cause other quicksorts to degrade to quadratic performance.

Parameters:
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.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if fromIndex > toIndex
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if fromIndex < 0 or toIndex > a.length

sort sample code for java.util.Arrays.sort(char[]) definition code for java.util.Arrays.sort(char[])

public static void sort(char[] a)
Sorts the specified array of chars into ascending numerical order. The sorting algorithm is a tuned quicksort, adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a Sort Function", Software-Practice and Experience, Vol. 23(11) P. 1249-1265 (November 1993). This algorithm offers n*log(n) performance on many data sets that cause other quicksorts to degrade to quadratic performance.

Parameters:
a - the array to be sorted.

sort sample code for java.util.Arrays.sort(char[], int, int) definition code for java.util.Arrays.sort(char[], int, int)

public static void sort(char[] a,
                        int fromIndex,
                        int toIndex)
Sorts the specified range of the specified array of chars into ascending numerical order. The range to be sorted extends from index fromIndex, inclusive, to index toIndex, exclusive. (If fromIndex==toIndex, the range to be sorted is empty.)

The sorting algorithm is a tuned quicksort, adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a Sort Function", Software-Practice and Experience, Vol. 23(11) P. 1249-1265 (November 1993). This algorithm offers n*log(n) performance on many data sets that cause other quicksorts to degrade to quadratic performance.

Parameters:
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.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if fromIndex > toIndex
ArrayIndexOutOfBoundsException sample code for java.lang.ArrayIndexOutOfBoundsException definition code for java.lang.ArrayIndexOutOfBoundsException - if fromIndex < 0 or toIndex > a.length

sort sample code for java.util.Arrays.sort(byte[]) definition code for java.util.Arrays.sort(byte[])

public static void sort(byte[] a)
Sorts the specified array of bytes into ascending numerical order. The sorting algorithm is a tuned quicksort, adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a Sort Function", Software-Practice and Experience, Vol. 23(11) P. 1249-1265 (November 1993). This algorithm offers n*log(n) performance on many data sets that cause other quicksorts to degrade to quadratic performance.

Parameters:
a - the array to be sorted.

sort sample code for java.util.Arrays.sort(byte[], int, int) definition code for java.util.Arrays.sort(byte[], int, int)

public static void sort(byte[] a,
                        int fromIndex,
                        int toIndex)
Sorts the specified range of the specified array of bytes into ascending numerical order. The range to be sorted extends from index fromIndex, inclusive, to index toIndex, exclusive. (If fromIndex==toIndex, the range to be sorted is empty.)

The sorting algorithm is a tuned quicksort, adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a Sort Function", Software-Practice and Experience, Vol. 23(11) P. 1249-1265 (November 1993). This algorithm offers n*log(n) performance on many data sets that cause other quicksorts to degrade to quadratic performance.

Parameters:
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.
Throws:
IllegalArgumentException