public class Arrays4D
extends java.lang.Object
NullPointerException
if the parameter array is null.
Implementations may use their own algorithms, but must obey the general properties; for example, the sort must be stable and n*log(n) complexity. Sun's implementation of sort, and therefore ours, is a tuned quicksort, adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a Sort Function", SoftwarePractice and Experience, Vol. 23(11) P. 12491265 (November 1993). This algorithm offers n*log(n) performance on many data sets that cause other quicksorts to degrade to quadratic performance.
Comparable
,
Comparator
Modifier and Type  Method and Description 

static <T> java.util.List<T> 
asList(T... a)
Returns a list "view" of the specified array.

static int 
binarySearch(byte[] a,
byte key)
Perform a binary search of a byte array for a key.

static int 
binarySearch(byte[] a,
int low,
int hi,
byte key)
Perform a binary search of a range of a byte array for a key.

static int 
binarySearch(char[] a,
char key)
Perform a binary search of a char array for a key.

static int 
binarySearch(char[] a,
int low,
int hi,
char key)
Perform a binary search of a range of a char array for a key.

static int 
binarySearch(double[] a,
double key)
Perform a binary search of a double array for a key.

static int 
binarySearch(double[] a,
int low,
int hi,
double key)
Perform a binary search of a range of a double array for a key.

static int 
binarySearch(int[] a,
int key)
Perform a binary search of an int array for a key.

static int 
binarySearch(int[] a,
int low,
int hi,
int key)
Perform a binary search of a range of an integer array for a key.

static int 
binarySearch(long[] a,
int low,
int hi,
long key)
Perform a binary search of a range of a long array for a key.

static int 
binarySearch(long[] a,
long key)
Perform a binary search of a long array for a key.

static int 
binarySearch(java.lang.Object[] a,
int low,
int hi,
java.lang.Object key)
Perform a binary search of a range of an Object array for a key.

static int 
binarySearch(java.lang.Object[] a,
java.lang.Object key)
Perform a binary search of an Object array for a key, using the natural
ordering of the elements.

static int 
binarySearch(short[] a,
int low,
int hi,
short key)
Perform a binary search of a range of a short array for a key.

static int 
binarySearch(short[] a,
short key)
Perform a binary search of a short array for a key.

static <T> int 
binarySearch(T[] a,
int low,
int hi,
T key,
java.util.Comparator<? super T> c)
Perform a binary search of a range of an Object array for a key using
a
Comparator . 
static <T> int 
binarySearch(T[] a,
T key,
java.util.Comparator<? super T> c)
Perform a binary search of an Object array for a key, using a supplied
Comparator.

static boolean[] 
copyOf(boolean[] original,
int newLength)
Returns a copy of the supplied array, truncating or padding as
necessary with
false to obtain the specified length. 
static byte[] 
copyOf(byte[] original,
int newLength)
Returns a copy of the supplied array, truncating or padding as
necessary with
(byte)0 to obtain the specified length. 
static char[] 
copyOf(char[] original,
int newLength)
Returns a copy of the supplied array, truncating or padding as
necessary with
'\0' to obtain the specified length. 
static double[] 
copyOf(double[] original,
int newLength)
Returns a copy of the supplied array, truncating or padding as
necessary with
0d to obtain the specified length. 
static int[] 
copyOf(int[] original,
int newLength)
Returns a copy of the supplied array, truncating or padding as
necessary with
0 to obtain the specified length. 
static long[] 
copyOf(long[] original,
int newLength)
Returns a copy of the supplied array, truncating or padding as
necessary with
0L to obtain the specified length. 
static short[] 
copyOf(short[] original,
int newLength)
Returns a copy of the supplied array, truncating or padding as
necessary with
(short)0 to obtain the specified length. 
static <T> T[] 
copyOf(T[] original,
int newLength)
Returns a copy of the supplied array, truncating or padding as
necessary with
null to obtain the specified length. 
static <T,U> T[] 
copyOf(U[] original,
int newLength,
java.lang.Class<? extends T[]> newType)
Returns a copy of the supplied array, truncating or padding as
necessary with
null to obtain the specified length. 
static boolean[] 
copyOfRange(boolean[] original,
int from,
int to)
Copies the specified range of the supplied array to a new
array, padding as necessary with
false
if to is greater than the length of the original
array. 
static byte[] 
copyOfRange(byte[] original,
int from,
int to)
Copies the specified range of the supplied array to a new
array, padding as necessary with
(byte)0
if to is greater than the length of the original
array. 
static char[] 
copyOfRange(char[] original,
int from,
int to)
Copies the specified range of the supplied array to a new
array, padding as necessary with
'\0'
if to is greater than the length of the original
array. 
static double[] 
copyOfRange(double[] original,
int from,
int to)
Copies the specified range of the supplied array to a new
array, padding as necessary with
0d
if to is greater than the length of the original
array. 
static int[] 
copyOfRange(int[] original,
int from,
int to)
Copies the specified range of the supplied array to a new
array, padding as necessary with
0
if to is greater than the length of the original
array. 
static long[] 
copyOfRange(long[] original,
int from,
int to)
Copies the specified range of the supplied array to a new
array, padding as necessary with
0L
if to is greater than the length of the original
array. 
static short[] 
copyOfRange(short[] original,
int from,
int to)
Copies the specified range of the supplied array to a new
array, padding as necessary with
(short)0
if to is greater than the length of the original
array. 
static <T> T[] 
copyOfRange(T[] original,
int from,
int to)
Copies the specified range of the supplied array to a new
array, padding as necessary with
null
if to is greater than the length of the original
array. 
static <T,U> T[] 
copyOfRange(U[] original,
int from,
int to,
java.lang.Class<? extends T[]> newType)
Copies the specified range of the supplied array to a new
array, padding as necessary with
null
if to is greater than the length of the original
array. 
static boolean 
deepEquals(java.lang.Object[] v1,
java.lang.Object[] v2) 
static int 
deepHashCode(java.lang.Object[] v) 
static java.lang.String 
deepToString(java.lang.Object[] v) 
static boolean 
equals(boolean[] a1,
boolean[] a2)
Compare two boolean arrays for equality.

static boolean 
equals(byte[] a1,
byte[] a2)
Compare two byte arrays for equality.

static boolean 
equals(char[] a1,
char[] a2)
Compare two char arrays for equality.

static boolean 
equals(double[] a1,
double[] a2)
Compare two double arrays for equality.

static boolean 
equals(int[] a1,
int[] a2)
Compare two int arrays for equality.

static boolean 
equals(long[] a1,
long[] a2)
Compare two long arrays for equality.

static boolean 
equals(java.lang.Object[] a1,
java.lang.Object[] a2)
Compare two Object arrays for equality.

static boolean 
equals(short[] a1,
short[] a2)
Compare two short arrays for equality.

static void 
fill(boolean[] a,
boolean val)
Fill an array with a boolean value.

static void 
fill(boolean[] a,
int fromIndex,
int toIndex,
boolean val)
Fill a range of an array with a boolean value.

static void 
fill(byte[] a,
byte val)
Fill an array with a byte value.

static void 
fill(byte[] a,
int fromIndex,
int toIndex,
byte val)
Fill a range of an array with a byte value.

static void 
fill(char[] a,
char val)
Fill an array with a char value.

static void 
fill(char[] a,
int fromIndex,
int toIndex,
char val)
Fill a range of an array with a char value.

static void 
fill(double[] a,
double val)
Fill an array with a double value.

static void 
fill(double[] a,
int fromIndex,
int toIndex,
double val)
Fill a range of an array with a double value.

static void 
fill(int[] a,
int val)
Fill an array with an int value.

static void 
fill(int[] a,
int fromIndex,
int toIndex,
int val)
Fill a range of an array with an int value.

static void 
fill(long[] a,
int fromIndex,
int toIndex,
long val)
Fill a range of an array with a long value.

static void 
fill(long[] a,
long val)
Fill an array with a long value.

static void 
fill(java.lang.Object[] a,
int fromIndex,
int toIndex,
java.lang.Object val)
Fill a range of an array with an Object value.

static void 
fill(java.lang.Object[] a,
java.lang.Object val)
Fill an array with an Object value.

static void 
fill(short[] a,
int fromIndex,
int toIndex,
short val)
Fill a range of an array with a short value.

static void 
fill(short[] a,
short val)
Fill an array with a short value.

static int 
hashCode(boolean[] v)
Returns the hashcode of an array of booleans.

static int 
hashCode(byte[] v)
Returns the hashcode of an array of bytes.

static int 
hashCode(char[] v)
Returns the hashcode of an array of characters.

static int 
hashCode(double[] v)
Returns the hashcode of an array of doubles.

static int 
hashCode(int[] v)
Returns the hashcode of an array of integer numbers.

static int 
hashCode(long[] v)
Returns the hashcode of an array of long numbers.

static int 
hashCode(java.lang.Object[] v)
Returns the hashcode of an array of objects.

static int 
hashCode(short[] v)
Returns the hashcode of an array of short numbers.

static void 
sort(byte[] a)
Performs a stable sort on the elements, arranging them according to their
natural order.

static void 
sort(byte[] a,
int fromIndex,
int toIndex)
Performs a stable sort on the elements, arranging them according to their
natural order.

static void 
sort(char[] a)
Performs a stable sort on the elements, arranging them according to their
natural order.

static void 
sort(char[] a,
int fromIndex,
int toIndex)
Performs a stable sort on the elements, arranging them according to their
natural order.

static void 
sort(double[] a)
Performs a stable sort on the elements, arranging them according to their
natural order.

static void 
sort(double[] a,
int fromIndex,
int toIndex)
Performs a stable sort on the elements, arranging them according to their
natural order.

static void 
sort(int[] a)
Performs a stable sort on the elements, arranging them according to their
natural order.

static void 
sort(int[] a,
int fromIndex,
int toIndex)
Performs a stable sort on the elements, arranging them according to their
natural order.

static void 
sort(long[] a)
Performs a stable sort on the elements, arranging them according to their
natural order.

static void 
sort(long[] a,
int fromIndex,
int toIndex)
Performs a stable sort on the elements, arranging them according to their
natural order.

static void 
sort(java.lang.Object[] a)
Sort an array of Objects according to their natural ordering.

static void 
sort(java.lang.Object[] a,
int fromIndex,
int toIndex)
Sort an array of Objects according to their natural ordering.

static void 
sort(short[] a)
Performs a stable sort on the elements, arranging them according to their
natural order.

static void 
sort(short[] a,
int fromIndex,
int toIndex)
Performs a stable sort on the elements, arranging them according to their
natural order.

static <T> void 
sort(T[] a,
java.util.Comparator<? super T> c)
Sort an array of Objects according to a Comparator.

static <T> void 
sort(T[] a,
int fromIndex,
int toIndex,
java.util.Comparator<? super T> c)
Sort an array of Objects according to a Comparator.

static java.lang.String 
toString(boolean[] v)
Returns a String representation of the argument array.

static java.lang.String 
toString(byte[] v)
Returns a String representation of the argument array.

static java.lang.String 
toString(char[] v)
Returns a String representation of the argument array.

static java.lang.String 
toString(double[] v)
Returns a String representation of the argument array.

static java.lang.String 
toString(int[] v)
Returns a String representation of the argument array.

static java.lang.String 
toString(long[] v)
Returns a String representation of the argument array.

static java.lang.String 
toString(java.lang.Object[] v)
Returns a String representation of the argument array.

static java.lang.String 
toString(short[] v)
Returns a String representation of the argument array.

public static int binarySearch(byte[] a, byte key)
a
 the array to search (must be sorted)key
 the value to search forpublic static int binarySearch(byte[] a, int low, int hi, byte key)
sort(byte[], int, int)
method) 
if it is not, the behaviour of this method is undefined, and may be an
infinite loop. If the array contains the key more than once, any one of
them may be found. Note: although the specification allows for an infinite
loop if the array is unsorted, it will not happen in this implementation.a
 the array to search (must be sorted)low
 the lowest index to search from.hi
 the highest index to search to.key
 the value to search forjava.lang.IllegalArgumentException
 if low > hi
java.lang.ArrayIndexOutOfBoundsException
 if low < 0
or
hi > a.length
.public static int binarySearch(char[] a, char key)
a
 the array to search (must be sorted)key
 the value to search forpublic static int binarySearch(char[] a, int low, int hi, char key)
sort(char[], int, int)
method) 
if it is not, the behaviour of this method is undefined, and may be an
infinite loop. If the array contains the key more than once, any one of
them may be found. Note: although the specification allows for an infinite
loop if the array is unsorted, it will not happen in this implementation.a
 the array to search (must be sorted)low
 the lowest index to search from.hi
 the highest index to search to.key
 the value to search forjava.lang.IllegalArgumentException
 if low > hi
java.lang.ArrayIndexOutOfBoundsException
 if low < 0
or
hi > a.length
.public static int binarySearch(short[] a, short key)
a
 the array to search (must be sorted)key
 the value to search forpublic static int binarySearch(short[] a, int low, int hi, short key)
sort(short[], int, int)
method) 
if it is not, the behaviour of this method is undefined, and may be an
infinite loop. If the array contains the key more than once, any one of
them may be found. Note: although the specification allows for an infinite
loop if the array is unsorted, it will not happen in this implementation.a
 the array to search (must be sorted)low
 the lowest index to search from.hi
 the highest index to search to.key
 the value to search forjava.lang.IllegalArgumentException
 if low > hi
java.lang.ArrayIndexOutOfBoundsException
 if low < 0
or
hi > a.length
.public static int binarySearch(int[] a, int key)
a
 the array to search (must be sorted)key
 the value to search forpublic static int binarySearch(int[] a, int low, int hi, int key)
sort(int[], int, int)
method) 
if it is not, the behaviour of this method is undefined, and may be an
infinite loop. If the array contains the key more than once, any one of
them may be found. Note: although the specification allows for an infinite
loop if the array is unsorted, it will not happen in this implementation.a
 the array to search (must be sorted)low
 the lowest index to search from.hi
 the highest index to search to.key
 the value to search forjava.lang.IllegalArgumentException
 if low > hi
java.lang.ArrayIndexOutOfBoundsException
 if low < 0
or
hi > a.length
.public static int binarySearch(long[] a, long key)
a
 the array to search (must be sorted)key
 the value to search forpublic static int binarySearch(long[] a, int low, int hi, long key)
sort(long[], int, int)
method) 
if it is not, the behaviour of this method is undefined, and may be an
infinite loop. If the array contains the key more than once, any one of
them may be found. Note: although the specification allows for an infinite
loop if the array is unsorted, it will not happen in this implementation.a
 the array to search (must be sorted)low
 the lowest index to search from.hi
 the highest index to search to.key
 the value to search forjava.lang.IllegalArgumentException
 if low > hi
java.lang.ArrayIndexOutOfBoundsException
 if low < 0
or
hi > a.length
.public static int binarySearch(double[] a, double key)
a
 the array to search (must be sorted)key
 the value to search forpublic static int binarySearch(double[] a, int low, int hi, double key)
sort(double[], int, int)
method) 
if it is not, the behaviour of this method is undefined, and may be an
infinite loop. If the array contains the key more than once, any one of
them may be found. Note: although the specification allows for an infinite
loop if the array is unsorted, it will not happen in this implementation.a
 the array to search (must be sorted)low
 the lowest index to search from.hi
 the highest index to search to.key
 the value to search forjava.lang.IllegalArgumentException
 if low > hi
java.lang.ArrayIndexOutOfBoundsException
 if low < 0
or
hi > a.length
.public static int binarySearch(java.lang.Object[] a, java.lang.Object key)
a
 the array to search (must be sorted)key
 the value to search forjava.lang.ClassCastException
 if key could not be compared with one of the
elements of ajava.lang.NullPointerException
 if a null element in a is comparedpublic static int binarySearch(java.lang.Object[] a, int low, int hi, java.lang.Object key)
sort(Object[], int, int)
method) 
if it is not, the behaviour of this method is undefined, and may be an
infinite loop. If the array contains the key more than once, any one of
them may be found. Note: although the specification allows for an infinite
loop if the array is unsorted, it will not happen in this implementation.a
 the array to search (must be sorted)low
 the lowest index to search from.hi
 the highest index to search to.key
 the value to search forpublic static <T> int binarySearch(T[] a, T key, java.util.Comparator<? super T> c)
a
 the array to search (must be sorted)key
 the value to search forc
 the comparator by which the array is sorted; or null to
use the elements' natural orderjava.lang.ClassCastException
 if key could not be compared with one of the
elements of ajava.lang.NullPointerException
 if a null element is compared with natural
ordering (only possible when c is null)public static <T> int binarySearch(T[] a, int low, int hi, T key, java.util.Comparator<? super T> c)
Comparator
. The range must be sorted (as by the
sort(Object[], int, int)
method)  if it is not, the
behaviour of this method is undefined, and may be an infinite loop. If
the array contains the key more than once, any one of them may be found.
Note: although the specification allows for an infinite loop if the array
is unsorted, it will not happen in this implementation.a
 the array to search (must be sorted)low
 the lowest index to search from.hi
 the highest index to search to.key
 the value to search forc
 the comparator by which the array is sorted; or null to
use the elements' natural orderjava.lang.ClassCastException
 if key could not be compared with one of the
elements of ajava.lang.IllegalArgumentException
 if low > hi
java.lang.ArrayIndexOutOfBoundsException
 if low < 0
or
hi > a.length
.public static boolean equals(boolean[] a1, boolean[] a2)
a1
 the first array to comparea2
 the second array to comparepublic static boolean equals(byte[] a1, byte[] a2)
a1
 the first array to comparea2
 the second array to comparepublic static boolean equals(char[] a1, char[] a2)
a1
 the first array to comparea2
 the second array to comparepublic static boolean equals(short[] a1, short[] a2)
a1
 the first array to comparea2
 the second array to comparepublic static boolean equals(int[] a1, int[] a2)
a1
 the first array to comparea2
 the second array to comparepublic static boolean equals(long[] a1, long[] a2)
a1
 the first array to comparea2
 the second array to comparepublic static boolean equals(double[] a1, double[] a2)
a1
 the first array to comparea2
 the second array to comparepublic static boolean equals(java.lang.Object[] a1, java.lang.Object[] a2)
a1
 the first array to comparea2
 the second array to comparepublic static void fill(boolean[] a, boolean val)
a
 the array to fillval
 the value to fill it withpublic static void fill(boolean[] a, int fromIndex, int toIndex, boolean val)
a
 the array to fillfromIndex
 the index to fill from, inclusivetoIndex
 the index to fill to, exclusiveval
 the value to fill withjava.lang.IllegalArgumentException
 if fromIndex > toIndexjava.lang.ArrayIndexOutOfBoundsException
 if fromIndex < 0
 toIndex > a.lengthpublic static void fill(byte[] a, byte val)
a
 the array to fillval
 the value to fill it withpublic static void fill(byte[] a, int fromIndex, int toIndex, byte val)
a
 the array to fillfromIndex
 the index to fill from, inclusivetoIndex
 the index to fill to, exclusiveval
 the value to fill withjava.lang.IllegalArgumentException
 if fromIndex > toIndexjava.lang.ArrayIndexOutOfBoundsException
 if fromIndex < 0
 toIndex > a.lengthpublic static void fill(char[] a, char val)
a
 the array to fillval
 the value to fill it withpublic static void fill(char[] a, int fromIndex, int toIndex, char val)
a
 the array to fillfromIndex
 the index to fill from, inclusivetoIndex
 the index to fill to, exclusiveval
 the value to fill withjava.lang.IllegalArgumentException
 if fromIndex > toIndexjava.lang.ArrayIndexOutOfBoundsException
 if fromIndex < 0
 toIndex > a.lengthpublic static void fill(short[] a, short val)
a
 the array to fillval
 the value to fill it withpublic static void fill(short[] a, int fromIndex, int toIndex, short val)
a
 the array to fillfromIndex
 the index to fill from, inclusivetoIndex
 the index to fill to, exclusiveval
 the value to fill withjava.lang.IllegalArgumentException
 if fromIndex > toIndexjava.lang.ArrayIndexOutOfBoundsException
 if fromIndex < 0
 toIndex > a.lengthpublic static void fill(int[] a, int val)
a
 the array to fillval
 the value to fill it withpublic static void fill(int[] a, int fromIndex, int toIndex, int val)
a
 the array to fillfromIndex
 the index to fill from, inclusivetoIndex
 the index to fill to, exclusiveval
 the value to fill withjava.lang.IllegalArgumentException
 if fromIndex > toIndexjava.lang.ArrayIndexOutOfBoundsException
 if fromIndex < 0
 toIndex > a.lengthpublic static void fill(long[] a, long val)
a
 the array to fillval
 the value to fill it withpublic static void fill(long[] a, int fromIndex, int toIndex, long val)
a
 the array to fillfromIndex
 the index to fill from, inclusivetoIndex
 the index to fill to, exclusiveval
 the value to fill withjava.lang.IllegalArgumentException
 if fromIndex > toIndexjava.lang.ArrayIndexOutOfBoundsException
 if fromIndex < 0
 toIndex > a.lengthpublic static void fill(double[] a, double val)
a
 the array to fillval
 the value to fill it withpublic static void fill(double[] a, int fromIndex, int toIndex, double val)
a
 the array to fillfromIndex
 the index to fill from, inclusivetoIndex
 the index to fill to, exclusiveval
 the value to fill withjava.lang.IllegalArgumentException
 if fromIndex > toIndexjava.lang.ArrayIndexOutOfBoundsException
 if fromIndex < 0
 toIndex > a.lengthpublic static void fill(java.lang.Object[] a, java.lang.Object val)
a
 the array to fillval
 the value to fill it withjava.lang.ClassCastException
 if val is not an instance of the element
type of a.public static void fill(java.lang.Object[] a, int fromIndex, int toIndex, java.lang.Object val)
a
 the array to fillfromIndex
 the index to fill from, inclusivetoIndex
 the index to fill to, exclusiveval
 the value to fill withjava.lang.ClassCastException
 if val is not an instance of the element
type of a.java.lang.IllegalArgumentException
 if fromIndex > toIndexjava.lang.ArrayIndexOutOfBoundsException
 if fromIndex < 0
 toIndex > a.lengthpublic static void sort(byte[] a)
a
 the byte array to sortpublic static void sort(byte[] a, int fromIndex, int toIndex)
a
 the byte array to sortfromIndex
 the first index to sort (inclusive)toIndex
 the last index to sort (exclusive)java.lang.IllegalArgumentException
 if fromIndex > toIndexjava.lang.ArrayIndexOutOfBoundsException
 if fromIndex < 0
 toIndex > a.lengthpublic static void sort(char[] a)
a
 the char array to sortpublic static void sort(char[] a, int fromIndex, int toIndex)
a
 the char array to sortfromIndex
 the first index to sort (inclusive)toIndex
 the last index to sort (exclusive)java.lang.IllegalArgumentException
 if fromIndex > toIndexjava.lang.ArrayIndexOutOfBoundsException
 if fromIndex < 0
 toIndex > a.lengthpublic static void sort(short[] a)
a
 the short array to sortpublic static void sort(short[] a, int fromIndex, int toIndex)
a
 the short array to sortfromIndex
 the first index to sort (inclusive)toIndex
 the last index to sort (exclusive)java.lang.IllegalArgumentException
 if fromIndex > toIndexjava.lang.ArrayIndexOutOfBoundsException
 if fromIndex < 0
 toIndex > a.lengthpublic static void sort(int[] a)
a
 the int array to sortpublic static void sort(int[] a, int fromIndex, int toIndex)
a
 the int array to sortfromIndex
 the first index to sort (inclusive)toIndex
 the last index to sort (exclusive)java.lang.IllegalArgumentException
 if fromIndex > toIndexjava.lang.ArrayIndexOutOfBoundsException
 if fromIndex < 0
 toIndex > a.lengthpublic static void sort(long[] a)
a
 the long array to sortpublic static void sort(long[] a, int fromIndex, int toIndex)
a
 the long array to sortfromIndex
 the first index to sort (inclusive)toIndex
 the last index to sort (exclusive)java.lang.IllegalArgumentException
 if fromIndex > toIndexjava.lang.ArrayIndexOutOfBoundsException
 if fromIndex < 0
 toIndex > a.lengthpublic static void sort(double[] a)
a
 the double array to sortpublic static void sort(double[] a, int fromIndex, int toIndex)
a
 the double array to sortfromIndex
 the first index to sort (inclusive)toIndex
 the last index to sort (exclusive)java.lang.IllegalArgumentException
 if fromIndex > toIndexjava.lang.ArrayIndexOutOfBoundsException
 if fromIndex < 0
 toIndex > a.lengthpublic static void sort(java.lang.Object[] a)
a
 the array to be sortedjava.lang.ClassCastException
 if any two elements are not mutually
comparablejava.lang.NullPointerException
 if an element is null (since
null.compareTo cannot work)Comparable
public static <T> void sort(T[] a, java.util.Comparator<? super T> c)
a
 the array to be sortedc
 a Comparator to use in sorting the array; or null to indicate
the elements' natural orderjava.lang.ClassCastException
 if any two elements are not mutually
comparable by the Comparator providedjava.lang.NullPointerException
 if a null element is compared with natural
ordering (only possible when c is null)public static void sort(java.lang.Object[] a, int fromIndex, int toIndex)
a
 the array to be sortedfromIndex
 the index of the first element to be sortedtoIndex
 the index of the last element to be sorted plus onejava.lang.ClassCastException
 if any two elements are not mutually
comparablejava.lang.NullPointerException
 if an element is null (since
null.compareTo cannot work)java.lang.ArrayIndexOutOfBoundsException
 if fromIndex and toIndex
are not in range.java.lang.IllegalArgumentException
 if fromIndex > toIndexpublic static <T> void sort(T[] a, int fromIndex, int toIndex, java.util.Comparator<? super T> c)
a
 the array to be sortedfromIndex
 the index of the first element to be sortedtoIndex
 the index of the last element to be sorted plus onec
 a Comparator to use in sorting the array; or null to indicate
the elements' natural orderjava.lang.ClassCastException
 if any two elements are not mutually
comparable by the Comparator providedjava.lang.ArrayIndexOutOfBoundsException
 if fromIndex and toIndex
are not in range.java.lang.IllegalArgumentException
 if fromIndex > toIndexjava.lang.NullPointerException
 if a null element is compared with natural
ordering (only possible when c is null)public static <T> java.util.List<T> asList(T... a)
a
 the array to return a view of (null
not permitted)java.lang.NullPointerException
 if a
is null
.RandomAccess
,
Arrays.ArrayList
public static int hashCode(long[] v)
equals()
, they should have the
same hashcode. The hashcode returned by the method is equal to that
obtained by the corresponding List
object. This has the same
data, but represents longs in their wrapper class, Long
.
For null
, 0 is returned.v
 an array of long numbers for which the hash code should be
computed.public static int hashCode(int[] v)
equals()
, they should have the
same hashcode. The hashcode returned by the method is equal to that
obtained by the corresponding List
object. This has the same
data, but represents ints in their wrapper class, Integer
.
For null
, 0 is returned.v
 an array of integer numbers for which the hash code should be
computed.public static int hashCode(short[] v)
equals()
, they should have the
same hashcode. The hashcode returned by the method is equal to that
obtained by the corresponding List
object. This has the same
data, but represents shorts in their wrapper class, Short
.
For null
, 0 is returned.v
 an array of short numbers for which the hash code should be
computed.public static int hashCode(char[] v)
equals()
, they should have the
same hashcode. The hashcode returned by the method is equal to that
obtained by the corresponding List
object. This has the same
data, but represents chars in their wrapper class, Character
.
For null
, 0 is returned.v
 an array of characters for which the hash code should be
computed.public static int hashCode(byte[] v)
equals()
, they should have the
same hashcode. The hashcode returned by the method is equal to that
obtained by the corresponding List
object. This has the same
data, but represents bytes in their wrapper class, Byte
.
For null
, 0 is returned.v
 an array of bytes for which the hash code should be
computed.public static int hashCode(boolean[] v)
equals()
, they should have the
same hashcode. The hashcode returned by the method is equal to that
obtained by the corresponding List
object. This has the same
data, but represents booleans in their wrapper class,
Boolean
. For null
, 0 is returned.v
 an array of booleans for which the hash code should be
computed.public static int hashCode(double[] v)
equals()
, they should have the
same hashcode. The hashcode returned by the method is equal to that
obtained by the corresponding List
object. This has the same
data, but represents doubles in their wrapper class, Double
.
For null
, 0 is returned.v
 an array of doubles for which the hash code should be
computed.public static int hashCode(java.lang.Object[] v)
equals()
, they should have the
same hashcode. The hashcode returned by the method is equal to that
obtained by the corresponding List
object.
For null
, 0 is returned.v
 an array of integer numbers for which the hash code should be
computed.public static int deepHashCode(java.lang.Object[] v)
public static boolean deepEquals(java.lang.Object[] v1, java.lang.Object[] v2)
public static java.lang.String toString(boolean[] v)
a
is null.v
 the array to representpublic static java.lang.String toString(byte[] v)
a
is null.v
 the array to representpublic static java.lang.String toString(char[] v)
a
is null.v
 the array to representpublic static java.lang.String toString(short[] v)
a
is null.v
 the array to representpublic static java.lang.String toString(int[] v)
a
is null.v
 the array to representpublic static java.lang.String toString(long[] v)
a
is null.v
 the array to representpublic static java.lang.String toString(double[] v)
a
is null.v
 the array to representpublic static java.lang.String toString(java.lang.Object[] v)
a
is null.v
 the array to representpublic static java.lang.String deepToString(java.lang.Object[] v)
public static boolean[] copyOf(boolean[] original, int newLength)
false
to obtain the specified length.
Indices that are valid for both arrays will return the same value.
Indices that only exist in the returned array (due to the new length
being greater than the original length) will return false
.
This is equivalent to calling
copyOfRange(original, 0, newLength)
.original
 the original array to be copied.newLength
 the length of the returned array.false
to obtain the required length.java.lang.NegativeArraySizeException
 if newLength
is negative.java.lang.NullPointerException
 if original
is null
.copyOfRange(boolean[],int,int)
public static boolean[] copyOfRange(boolean[] original, int from, int to)
false
if to
is greater than the length of the original
array. from
must be in the range zero to
original.length
and can not be greater than
to
. The initial element of the
returned array will be equal to original[from]
,
except where from
is equal to to
(where a zerolength array will be returned) or
from
is equal to original.length
(where an array padded with false
will be
returned). The returned array is always of length
to  from
.
 Parameters:
original
 the array from which to copy.
from
 the initial index of the range, inclusive.
to
 the final index of the range, exclusive.
 Returns:
 a copy of the specified range, with padding to
obtain the required length.
 Throws:
java.lang.ArrayIndexOutOfBoundsException
 if from < 0
or from > original.length
java.lang.IllegalArgumentException
 if from > to
java.lang.NullPointerException
 if original
is null
.
 Since:
 1.6
 See Also:
copyOf(boolean[],int)

copyOf
public static byte[] copyOf(byte[] original,
int newLength)
Returns a copy of the supplied array, truncating or padding as
necessary with (byte)0
to obtain the specified length.
Indices that are valid for both arrays will return the same value.
Indices that only exist in the returned array (due to the new length
being greater than the original length) will return (byte)0
.
This is equivalent to calling
copyOfRange(original, 0, newLength)
.
 Parameters:
original
 the original array to be copied.
newLength
 the length of the returned array.
 Returns:
 a copy of the original array, truncated or padded with
(byte)0
to obtain the required length.
 Throws:
java.lang.NegativeArraySizeException
 if newLength
is negative.
java.lang.NullPointerException
 if original
is null
.
 Since:
 1.6
 See Also:
copyOfRange(byte[],int,int)

copyOfRange
public static byte[] copyOfRange(byte[] original,
int from,
int to)
Copies the specified range of the supplied array to a new
array, padding as necessary with (byte)0
if to
is greater than the length of the original
array. from
must be in the range zero to
original.length
and can not be greater than
to
. The initial element of the
returned array will be equal to original[from]
,
except where from
is equal to to
(where a zerolength array will be returned) or
from
is equal to original.length
(where an array padded with (byte)0
will be
returned). The returned array is always of length
to  from
.
 Parameters:
original
 the array from which to copy.
from
 the initial index of the range, inclusive.
to
 the final index of the range, exclusive.
 Returns:
 a copy of the specified range, with padding to
obtain the required length.
 Throws:
java.lang.ArrayIndexOutOfBoundsException
 if from < 0
or from > original.length
java.lang.IllegalArgumentException
 if from > to
java.lang.NullPointerException
 if original
is null
.
 Since:
 1.6
 See Also:
copyOf(byte[],int)

copyOf
public static char[] copyOf(char[] original,
int newLength)
Returns a copy of the supplied array, truncating or padding as
necessary with '\0'
to obtain the specified length.
Indices that are valid for both arrays will return the same value.
Indices that only exist in the returned array (due to the new length
being greater than the original length) will return '\0'
.
This is equivalent to calling
copyOfRange(original, 0, newLength)
.
 Parameters:
original
 the original array to be copied.
newLength
 the length of the returned array.
 Returns:
 a copy of the original array, truncated or padded with
'\0'
to obtain the required length.
 Throws:
java.lang.NegativeArraySizeException
 if newLength
is negative.
java.lang.NullPointerException
 if original
is null
.
 Since:
 1.6
 See Also:
copyOfRange(char[],int,int)

copyOfRange
public static char[] copyOfRange(char[] original,
int from,
int to)
Copies the specified range of the supplied array to a new
array, padding as necessary with '\0'
if to
is greater than the length of the original
array. from
must be in the range zero to
original.length
and can not be greater than
to
. The initial element of the
returned array will be equal to original[from]
,
except where from
is equal to to
(where a zerolength array will be returned) or
from
is equal to original.length
(where an array padded with '\0'
will be
returned). The returned array is always of length
to  from
.
 Parameters:
original
 the array from which to copy.
from
 the initial index of the range, inclusive.
to
 the final index of the range, exclusive.
 Returns:
 a copy of the specified range, with padding to
obtain the required length.
 Throws:
java.lang.ArrayIndexOutOfBoundsException
 if from < 0
or from > original.length
java.lang.IllegalArgumentException
 if from > to
java.lang.NullPointerException
 if original
is null
.
 Since:
 1.6
 See Also:
copyOf(char[],int)

copyOf
public static double[] copyOf(double[] original,
int newLength)
Returns a copy of the supplied array, truncating or padding as
necessary with 0d
to obtain the specified length.
Indices that are valid for both arrays will return the same value.
Indices that only exist in the returned array (due to the new length
being greater than the original length) will return 0d
.
This is equivalent to calling
copyOfRange(original, 0, newLength)
.
 Parameters:
original
 the original array to be copied.
newLength
 the length of the returned array.
 Returns:
 a copy of the original array, truncated or padded with
0d
to obtain the required length.
 Throws:
java.lang.NegativeArraySizeException
 if newLength
is negative.
java.lang.NullPointerException
 if original
is null
.
 Since:
 1.6
 See Also:
copyOfRange(double[],int,int)

copyOfRange
public static double[] copyOfRange(double[] original,
int from,
int to)
Copies the specified range of the supplied array to a new
array, padding as necessary with 0d
if to
is greater than the length of the original
array. from
must be in the range zero to
original.length
and can not be greater than
to
. The initial element of the
returned array will be equal to original[from]
,
except where from
is equal to to
(where a zerolength array will be returned) or
from
is equal to original.length
(where an array padded with 0d
will be
returned). The returned array is always of length
to  from
.
 Parameters:
original
 the array from which to copy.
from
 the initial index of the range, inclusive.
to
 the final index of the range, exclusive.
 Returns:
 a copy of the specified range, with padding to
obtain the required length.
 Throws:
java.lang.ArrayIndexOutOfBoundsException
 if from < 0
or from > original.length
java.lang.IllegalArgumentException
 if from > to
java.lang.NullPointerException
 if original
is null
.
 Since:
 1.6
 See Also:
copyOf(double[],int)

copyOf
public static int[] copyOf(int[] original,
int newLength)
Returns a copy of the supplied array, truncating or padding as
necessary with 0
to obtain the specified length.
Indices that are valid for both arrays will return the same value.
Indices that only exist in the returned array (due to the new length
being greater than the original length) will return 0
.
This is equivalent to calling
copyOfRange(original, 0, newLength)
.
 Parameters:
original
 the original array to be copied.
newLength
 the length of the returned array.
 Returns:
 a copy of the original array, truncated or padded with
0
to obtain the required length.
 Throws:
java.lang.NegativeArraySizeException
 if newLength
is negative.
java.lang.NullPointerException
 if original
is null
.
 Since:
 1.6
 See Also:
copyOfRange(int[],int,int)

copyOfRange
public static int[] copyOfRange(int[] original,
int from,
int to)
Copies the specified range of the supplied array to a new
array, padding as necessary with 0
if to
is greater than the length of the original
array. from
must be in the range zero to
original.length
and can not be greater than
to
. The initial element of the
returned array will be equal to original[from]
,
except where from
is equal to to
(where a zerolength array will be returned) or
from
is equal to original.length
(where an array padded with 0
will be
returned). The returned array is always of length
to  from
.
 Parameters:
original
 the array from which to copy.
from
 the initial index of the range, inclusive.
to
 the final index of the range, exclusive.
 Returns:
 a copy of the specified range, with padding to
obtain the required length.
 Throws:
java.lang.ArrayIndexOutOfBoundsException
 if from < 0
or from > original.length
java.lang.IllegalArgumentException
 if from > to
java.lang.NullPointerException
 if original
is null
.
 Since:
 1.6
 See Also:
copyOf(int[],int)

copyOf
public static long[] copyOf(long[] original,
int newLength)
Returns a copy of the supplied array, truncating or padding as
necessary with 0L
to obtain the specified length.
Indices that are valid for both arrays will return the same value.
Indices that only exist in the returned array (due to the new length
being greater than the original length) will return 0L
.
This is equivalent to calling
copyOfRange(original, 0, newLength)
.
 Parameters:
original
 the original array to be copied.
newLength
 the length of the returned array.
 Returns:
 a copy of the original array, truncated or padded with
0L
to obtain the required length.
 Throws:
java.lang.NegativeArraySizeException
 if newLength
is negative.
java.lang.NullPointerException
 if original
is null
.
 Since:
 1.6
 See Also:
copyOfRange(long[],int,int)

copyOfRange
public static long[] copyOfRange(long[] original,
int from,
int to)
Copies the specified range of the supplied array to a new
array, padding as necessary with 0L
if to
is greater than the length of the original
array. from
must be in the range zero to
original.length
and can not be greater than
to
. The initial element of the
returned array will be equal to original[from]
,
except where from
is equal to to
(where a zerolength array will be returned) or
from
is equal to original.length
(where an array padded with 0L
will be
returned). The returned array is always of length
to  from
.
 Parameters:
original
 the array from which to copy.
from
 the initial index of the range, inclusive.
to
 the final index of the range, exclusive.
 Returns:
 a copy of the specified range, with padding to
obtain the required length.
 Throws:
java.lang.ArrayIndexOutOfBoundsException
 if from < 0
or from > original.length
java.lang.IllegalArgumentException
 if from > to
java.lang.NullPointerException
 if original
is null
.
 Since:
 1.6
 See Also:
copyOf(long[],int)

copyOf
public static short[] copyOf(short[] original,
int newLength)
Returns a copy of the supplied array, truncating or padding as
necessary with (short)0
to obtain the specified length.
Indices that are valid for both arrays will return the same value.
Indices that only exist in the returned array (due to the new length
being greater than the original length) will return (short)0
.
This is equivalent to calling
copyOfRange(original, 0, newLength)
.
 Parameters:
original
 the original array to be copied.
newLength
 the length of the returned array.
 Returns:
 a copy of the original array, truncated or padded with
(short)0
to obtain the required length.
 Throws:
java.lang.NegativeArraySizeException
 if newLength
is negative.
java.lang.NullPointerException
 if original
is null
.
 Since:
 1.6
 See Also:
copyOfRange(short[],int,int)

copyOfRange
public static short[] copyOfRange(short[] original,
int from,
int to)
Copies the specified range of the supplied array to a new
array, padding as necessary with (short)0
if to
is greater than the length of the original
array. from
must be in the range zero to
original.length
and can not be greater than
to
. The initial element of the
returned array will be equal to original[from]
,
except where from
is equal to to
(where a zerolength array will be returned) or
from
is equal to original.length
(where an array padded with (short)0
will be
returned). The returned array is always of length
to  from
.
 Parameters:
original
 the array from which to copy.
from
 the initial index of the range, inclusive.
to
 the final index of the range, exclusive.
 Returns:
 a copy of the specified range, with padding to
obtain the required length.
 Throws:
java.lang.ArrayIndexOutOfBoundsException
 if from < 0
or from > original.length
java.lang.IllegalArgumentException
 if from > to
java.lang.NullPointerException
 if original
is null
.
 Since:
 1.6
 See Also:
copyOf(short[],int)

copyOf
public static <T> T[] copyOf(T[] original,
int newLength)
Returns a copy of the supplied array, truncating or padding as
necessary with null
to obtain the specified length.
Indices that are valid for both arrays will return the same value.
Indices that only exist in the returned array (due to the new length
being greater than the original length) will return null
.
This is equivalent to calling
copyOfRange(original, 0, newLength)
.
 Parameters:
original
 the original array to be copied.
newLength
 the length of the returned array.
 Returns:
 a copy of the original array, truncated or padded with
null
to obtain the required length.
 Throws:
java.lang.NegativeArraySizeException
 if newLength
is negative.
java.lang.NullPointerException
 if original
is null
.
 Since:
 1.6
 See Also:
#copyOfRange(T[],int,int)

copyOfRange
public static <T> T[] copyOfRange(T[] original,
int from,
int to)
Copies the specified range of the supplied array to a new
array, padding as necessary with null
if to
is greater than the length of the original
array. from
must be in the range zero to
original.length
and can not be greater than
to
. The initial element of the
returned array will be equal to original[from]
,
except where from
is equal to to
(where a zerolength array will be returned) or
from
is equal to original.length
(where an array padded with null
will be
returned). The returned array is always of length
to  from
.
 Parameters:
original
 the array from which to copy.
from
 the initial index of the range, inclusive.
to
 the final index of the range, exclusive.
 Returns:
 a copy of the specified range, with padding to
obtain the required length.
 Throws:
java.lang.ArrayIndexOutOfBoundsException
 if from < 0
or from > original.length
java.lang.IllegalArgumentException
 if from > to
java.lang.NullPointerException
 if original
is null
.
 Since:
 1.6
 See Also:
#copyOf(T[],int)

copyOf
public static <T,U> T[] copyOf(U[] original,
int newLength,
java.lang.Class<? extends T[]> newType)
Returns a copy of the supplied array, truncating or padding as
necessary with null
to obtain the specified length.
Indices that are valid for both arrays will return the same value.
Indices that only exist in the returned array (due to the new length
being greater than the original length) will return null
.
This is equivalent to calling
copyOfRange(original, 0, newLength, newType)
. The returned
array will be of the specified type, newType
.
 Parameters:
original
 the original array to be copied.
newLength
 the length of the returned array.
newType
 the type of the returned array.
 Returns:
 a copy of the original array, truncated or padded with
null
to obtain the required length.
 Throws:
java.lang.NegativeArraySizeException
 if newLength
is negative.
java.lang.NullPointerException
 if original
is null
.
 Since:
 1.6
 See Also:
#copyOfRange(U[],int,int,Class)

copyOfRange
public static <T,U> T[] copyOfRange(U[] original,
int from,
int to,
java.lang.Class<? extends T[]> newType)
Copies the specified range of the supplied array to a new
array, padding as necessary with null
if to
is greater than the length of the original
array. from
must be in the range zero to
original.length
and can not be greater than
to
. The initial element of the
returned array will be equal to original[from]
,
except where from
is equal to to
(where a zerolength array will be returned) or
from
is equal to original.length
(where an array padded with null
will be
returned). The returned array is always of length
to  from
and will be of the specified type,
newType
.
 Parameters:
original
 the array from which to copy.
from
 the initial index of the range, inclusive.
to
 the final index of the range, exclusive.
newType
 the type of the returned array.
 Returns:
 a copy of the specified range, with padding to
obtain the required length.
 Throws:
java.lang.ArrayIndexOutOfBoundsException
 if from < 0
or from > original.length
java.lang.IllegalArgumentException
 if from > to
java.lang.NullPointerException
 if original
is null
.
 Since:
 1.6
 See Also:
#copyOf(T[],int)