|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.Arrays
public class Arrays
Various tools for arrays. NOTE: currently bubblesort is used for sorting arrays.
| Method Summary | |
|---|---|
static int |
binarySearch(byte[] a,
byte val)
Binary search for element in sorted array. |
static int |
binarySearch(byte[] a,
int fromIndex,
int toIndex,
byte key)
Binary search for element in sorted array. |
static int |
binarySearch(char[] a,
char val)
Binary search for element in sorted array. |
static int |
binarySearch(char[] a,
int fromIndex,
int toIndex,
char key)
Binary search for element in sorted array. |
static int |
binarySearch(double[] a,
double val)
Binary search for element in sorted array. |
static int |
binarySearch(double[] a,
int fromIndex,
int toIndex,
double key)
Binary search for element in sorted array. |
static int |
binarySearch(float[] a,
float val)
Binary search for element in sorted array. |
static int |
binarySearch(float[] a,
int fromIndex,
int toIndex,
float key)
Binary search for element in sorted array. |
static int |
binarySearch(int[] a,
int val)
Binary search for element in sorted array. |
static int |
binarySearch(int[] a,
int fromIndex,
int toIndex,
int key)
Binary search for element in sorted array. |
static int |
binarySearch(long[] a,
int fromIndex,
int toIndex,
long key)
Binary search for element in sorted array. |
static int |
binarySearch(long[] a,
long val)
Binary search for element in sorted array. |
static int |
binarySearch(Object[] a,
int fromIndex,
int toIndex,
Object key)
Binary search for element in sorted array. |
static int |
binarySearch(Object[] a,
Object val)
Binary search for element in sorted array. |
static int |
binarySearch(short[] a,
int fromIndex,
int toIndex,
short key)
Binary search for element in sorted array. |
static int |
binarySearch(short[] a,
short val)
Binary search for element in sorted array. |
static boolean[] |
copyOf(boolean[] a,
int newLength)
Creates a copy with a given length of an array. |
static byte[] |
copyOf(byte[] a,
int newLength)
Creates a copy with a given length of an array. |
static char[] |
copyOf(char[] a,
int newLength)
Creates a copy with a given length of an array. |
static double[] |
copyOf(double[] a,
int newLength)
Creates a copy with a given length of an array. |
static float[] |
copyOf(float[] a,
int newLength)
Creates a copy with a given length of an array. |
static int[] |
copyOf(int[] a,
int newLength)
Creates a copy with a given length of an array. |
static long[] |
copyOf(long[] a,
int newLength)
Creates a copy with a given length of an array. |
static short[] |
copyOf(short[] a,
int newLength)
Creates a copy with a given length of an array. |
static boolean[] |
copyOfRange(boolean[] a,
int fromIndex,
int toIndex)
Creates a copy with a given length of an array. |
static byte[] |
copyOfRange(byte[] a,
int fromIndex,
int toIndex)
Creates a copy with a given length of an array. |
static char[] |
copyOfRange(char[] a,
int fromIndex,
int toIndex)
Creates a copy with a given length of an array. |
static double[] |
copyOfRange(double[] a,
int fromIndex,
int toIndex)
Creates a copy with a given length of an array. |
static float[] |
copyOfRange(float[] a,
int fromIndex,
int toIndex)
Creates a copy with a given length of an array. |
static int[] |
copyOfRange(int[] a,
int fromIndex,
int toIndex)
Creates a copy with a given length of an array. |
static long[] |
copyOfRange(long[] a,
int fromIndex,
int toIndex)
Creates a copy with a given length of an array. |
static short[] |
copyOfRange(short[] a,
int fromIndex,
int toIndex)
Creates a copy with a given length of an array. |
static boolean |
equals(boolean[] a,
boolean[] b)
EQUALS |
static boolean |
equals(byte[] a,
byte[] b)
|
static boolean |
equals(char[] a,
char[] b)
|
static boolean |
equals(double[] a,
double[] b)
|
static boolean |
equals(float[] a,
float[] b)
|
static boolean |
equals(int[] a,
int[] b)
|
static boolean |
equals(long[] a,
long[] b)
|
static boolean |
equals(Object[] a,
Object[] b)
|
static boolean |
equals(short[] a,
short[] b)
|
static void |
fill(boolean[] a,
boolean val)
Set array elements to given value. |
static void |
fill(boolean[] a,
int fromIndex,
int toIndex,
boolean val)
Set array elements to given value. |
static void |
fill(byte[] a,
byte val)
Set array elements to given value. |
static void |
fill(byte[] a,
int fromIndex,
int toIndex,
byte val)
Set array elements to given value. |
static void |
fill(char[] a,
char val)
Set array elements to given value. |
static void |
fill(char[] a,
int fromIndex,
int toIndex,
char val)
Set array elements to given value. |
static void |
fill(double[] a,
double val)
Set array elements to given value. |
static void |
fill(double[] a,
int fromIndex,
int toIndex,
double val)
Set array elements to given value. |
static void |
fill(float[] a,
float val)
Set array elements to given value. |
static void |
fill(float[] a,
int fromIndex,
int toIndex,
float val)
Set array elements to given value. |
static void |
fill(int[] a,
int val)
Set array elements to given value. |
static void |
fill(int[] a,
int fromIndex,
int toIndex,
int val)
Set array elements to given value. |
static void |
fill(long[] a,
int fromIndex,
int toIndex,
long val)
Set array elements to given value. |
static void |
fill(long[] a,
long val)
Set array elements to given value. |
static void |
fill(Object[] a,
int fromIndex,
int toIndex,
Object val)
Set array elements to given value. |
static void |
fill(Object[] a,
Object val)
Set array elements to given value. |
static void |
fill(short[] a,
int fromIndex,
int toIndex,
short val)
Set array elements to given value. |
static void |
fill(short[] a,
short val)
Set array elements to given value. |
static void |
sort(byte[] a)
Sort the specified array in ascending order. |
static void |
sort(byte[] a,
int fromIndex,
int toIndex)
Sort the specified array in ascending order. |
static void |
sort(char[] a)
Sort the specified array in ascending order. |
static void |
sort(char[] a,
int fromIndex,
int toIndex)
Sort the specified array in ascending order. |
static void |
sort(double[] a)
Sort the specified array in ascending order. |
static void |
sort(double[] a,
int fromIndex,
int toIndex)
Sort the specified array in ascending order. |
static void |
sort(float[] a)
Sort the specified array in ascending order. |
static void |
sort(float[] a,
int fromIndex,
int toIndex)
Sort the specified array in ascending order. |
static void |
sort(int[] a)
Sort the specified array in ascending order. |
static void |
sort(int[] a,
int fromIndex,
int toIndex)
Sort the specified array in ascending order. |
static void |
sort(long[] a)
Sort the specified array in ascending order. |
static void |
sort(long[] a,
int fromIndex,
int toIndex)
Sort the specified array in ascending order. |
static void |
sort(Object[] a)
Sort the specified array in ascending order. |
static void |
sort(Object[] a,
int fromIndex,
int toIndex)
Sort the specified array in ascending order. |
static void |
sort(short[] a)
Sort the specified array in ascending order. |
static void |
sort(short[] a,
int fromIndex,
int toIndex)
Sort the specified array in ascending order. |
static String |
toString(boolean[] a)
Returns a String representation of the array. |
static String |
toString(byte[] a)
Returns a String representation of the array. |
static String |
toString(char[] a)
Returns a String representation of the array. |
static String |
toString(double[] a)
Returns a String representation of the array. |
static String |
toString(float[] a)
Returns a String representation of the array. |
static String |
toString(int[] a)
Returns a String representation of the array. |
static String |
toString(long[] a)
Returns a String representation of the array. |
static String |
toString(Object[] a)
Returns a String representation of the array. |
static String |
toString(short[] a)
Returns a String representation of the array. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static int binarySearch(byte[] a,
byte val)
a - the sorted arrayval - the value
(-index -1) where index
denotes the index at which the element should be inserted
public static int binarySearch(byte[] a,
int fromIndex,
int toIndex,
byte key)
a - the sorted arrayfromIndex - index of first element (inclusive) to considertoIndex - index of last element (exclusive) to considerkey - the value to search for
(-index -1) where index
denotes the index at which the element should be inserted
public static int binarySearch(short[] a,
short val)
a - the sorted arrayval - the value
(-index -1) where index
denotes the index at which the element should be inserted
public static int binarySearch(short[] a,
int fromIndex,
int toIndex,
short key)
a - the sorted arrayfromIndex - index of first element (inclusive) to considertoIndex - index of last element (exclusive) to considerkey - the value to search for
(-index -1) where index
denotes the index at which the element should be inserted
public static int binarySearch(char[] a,
char val)
a - the sorted arrayval - the value
(-index -1) where index
denotes the index at which the element should be inserted
public static int binarySearch(char[] a,
int fromIndex,
int toIndex,
char key)
a - the sorted arrayfromIndex - index of first element (inclusive) to considertoIndex - index of last element (exclusive) to considerkey - the value to search for
(-index -1) where index
denotes the index at which the element should be inserted
public static int binarySearch(int[] a,
int val)
a - the sorted arrayval - the value
(-index -1) where index
denotes the index at which the element should be inserted
public static int binarySearch(int[] a,
int fromIndex,
int toIndex,
int key)
a - the sorted arrayfromIndex - index of first element (inclusive) to considertoIndex - index of last element (exclusive) to considerkey - the value to search for
(-index -1) where index
denotes the index at which the element should be inserted
public static int binarySearch(long[] a,
long val)
a - the sorted arrayval - the value
(-index -1) where index
denotes the index at which the element should be inserted
public static int binarySearch(long[] a,
int fromIndex,
int toIndex,
long key)
a - the sorted arrayfromIndex - index of first element (inclusive) to considertoIndex - index of last element (exclusive) to considerkey - the value to search for
(-index -1) where index
denotes the index at which the element should be inserted
public static int binarySearch(float[] a,
float val)
a - the sorted arrayval - the value
(-index -1) where index
denotes the index at which the element should be inserted
public static int binarySearch(float[] a,
int fromIndex,
int toIndex,
float key)
a - the sorted arrayfromIndex - index of first element (inclusive) to considertoIndex - index of last element (exclusive) to considerkey - the value to search for
(-index -1) where index
denotes the index at which the element should be inserted
public static int binarySearch(double[] a,
double val)
a - the sorted arrayval - the value
(-index -1) where index
denotes the index at which the element should be inserted
public static int binarySearch(double[] a,
int fromIndex,
int toIndex,
double key)
a - the sorted arrayfromIndex - index of first element (inclusive) to considertoIndex - index of last element (exclusive) to considerkey - the value to search for
(-index -1) where index
denotes the index at which the element should be inserted
public static int binarySearch(Object[] a,
Object val)
a - the sorted arrayval - the value
(-index -1) where index
denotes the index at which the element should be inserted
public static int binarySearch(Object[] a,
int fromIndex,
int toIndex,
Object key)
a - the sorted arrayfromIndex - index of first element (inclusive) to considertoIndex - index of last element (exclusive) to considerkey - the value to search for
(-index -1) where index
denotes the index at which the element should be inserted
public static boolean[] copyOf(boolean[] a,
int newLength)
a - the array to copynewLength - length of the copy
public static byte[] copyOf(byte[] a,
int newLength)
a - the array to copynewLength - length of the copy
public static short[] copyOf(short[] a,
int newLength)
a - the array to copynewLength - length of the copy
public static char[] copyOf(char[] a,
int newLength)
a - the array to copynewLength - length of the copy
public static int[] copyOf(int[] a,
int newLength)
a - the array to copynewLength - length of the copy
public static long[] copyOf(long[] a,
int newLength)
a - the array to copynewLength - length of the copy
public static float[] copyOf(float[] a,
int newLength)
a - the array to copynewLength - length of the copy
public static double[] copyOf(double[] a,
int newLength)
a - the array to copynewLength - length of the copy
public static boolean[] copyOfRange(boolean[] a,
int fromIndex,
int toIndex)
toIndex may be larger then a.length.
a - the array to copyfromIndex - index of first element (inclusive) to copytoIndex - index of last element (exclusive) to copy
public static byte[] copyOfRange(byte[] a,
int fromIndex,
int toIndex)
toIndex may be larger then a.length.
a - the array to copyfromIndex - index of first element (inclusive) to copytoIndex - index of last element (exclusive) to copy
public static short[] copyOfRange(short[] a,
int fromIndex,
int toIndex)
toIndex may be larger then a.length.
a - the array to copyfromIndex - index of first element (inclusive) to copytoIndex - index of last element (exclusive) to copy
public static char[] copyOfRange(char[] a,
int fromIndex,
int toIndex)
toIndex may be larger then a.length.
a - the array to copyfromIndex - index of first element (inclusive) to copytoIndex - index of last element (exclusive) to copy
public static int[] copyOfRange(int[] a,
int fromIndex,
int toIndex)
toIndex may be larger then a.length.
a - the array to copyfromIndex - index of first element (inclusive) to copytoIndex - index of last element (exclusive) to copy
public static long[] copyOfRange(long[] a,
int fromIndex,
int toIndex)
toIndex may be larger then a.length.
a - the array to copyfromIndex - index of first element (inclusive) to copytoIndex - index of last element (exclusive) to copy
public static float[] copyOfRange(float[] a,
int fromIndex,
int toIndex)
toIndex may be larger then a.length.
a - the array to copyfromIndex - index of first element (inclusive) to copytoIndex - index of last element (exclusive) to copy
public static double[] copyOfRange(double[] a,
int fromIndex,
int toIndex)
toIndex may be larger then a.length.
a - the array to copyfromIndex - index of first element (inclusive) to copytoIndex - index of last element (exclusive) to copy
public static boolean equals(boolean[] a,
boolean[] b)
public static boolean equals(byte[] a,
byte[] b)
public static boolean equals(short[] a,
short[] b)
public static boolean equals(char[] a,
char[] b)
public static boolean equals(int[] a,
int[] b)
public static boolean equals(long[] a,
long[] b)
public static boolean equals(float[] a,
float[] b)
public static boolean equals(double[] a,
double[] b)
public static boolean equals(Object[] a,
Object[] b)
public static void fill(boolean[] a,
boolean val)
a - the arrayval - the value
public static void fill(boolean[] a,
int fromIndex,
int toIndex,
boolean val)
a - the arrayfromIndex - index of first element (inclusive) to settoIndex - index of last element (exclusive) to setval - the value
public static void fill(byte[] a,
byte val)
a - the arrayval - the value
public static void fill(byte[] a,
int fromIndex,
int toIndex,
byte val)
a - the arrayfromIndex - index of first element (inclusive) to settoIndex - index of last element (exclusive) to setval - the value
public static void fill(short[] a,
short val)
a - the arrayval - the value
public static void fill(short[] a,
int fromIndex,
int toIndex,
short val)
a - the arrayfromIndex - index of first element (inclusive) to settoIndex - index of last element (exclusive) to setval - the value
public static void fill(char[] a,
char val)
a - the arrayval - the value
public static void fill(char[] a,
int fromIndex,
int toIndex,
char val)
a - the arrayfromIndex - index of first element (inclusive) to settoIndex - index of last element (exclusive) to setval - the value
public static void fill(int[] a,
int val)
a - the arrayval - the value
public static void fill(int[] a,
int fromIndex,
int toIndex,
int val)
a - the arrayfromIndex - index of first element (inclusive) to settoIndex - index of last element (exclusive) to setval - the value
public static void fill(long[] a,
long val)
a - the arrayval - the value
public static void fill(long[] a,
int fromIndex,
int toIndex,
long val)
a - the arrayfromIndex - index of first element (inclusive) to settoIndex - index of last element (exclusive) to setval - the value
public static void fill(float[] a,
float val)
a - the arrayval - the value
public static void fill(float[] a,
int fromIndex,
int toIndex,
float val)
a - the arrayfromIndex - index of first element (inclusive) to settoIndex - index of last element (exclusive) to setval - the value
public static void fill(double[] a,
double val)
a - the arrayval - the value
public static void fill(double[] a,
int fromIndex,
int toIndex,
double val)
a - the arrayfromIndex - index of first element (inclusive) to settoIndex - index of last element (exclusive) to setval - the value
public static void fill(Object[] a,
Object val)
a - the arrayval - the value
public static void fill(Object[] a,
int fromIndex,
int toIndex,
Object val)
a - the arrayfromIndex - index of first element (inclusive) to settoIndex - index of last element (exclusive) to setval - the valuepublic static void sort(byte[] a)
a - the array to sort
public static void sort(byte[] a,
int fromIndex,
int toIndex)
a - the array to sortfromIndex - index of first element (inclusive) to sorttoIndex - index of last element (exclusive) to sortpublic static void sort(short[] a)
a - the array to sort
public static void sort(short[] a,
int fromIndex,
int toIndex)
a - the array to sortfromIndex - index of first element (inclusive) to sorttoIndex - index of last element (exclusive) to sortpublic static void sort(char[] a)
a - the array to sort
public static void sort(char[] a,
int fromIndex,
int toIndex)
a - the array to sortfromIndex - index of first element (inclusive) to sorttoIndex - index of last element (exclusive) to sortpublic static void sort(int[] a)
a - the array to sort
public static void sort(int[] a,
int fromIndex,
int toIndex)
a - the array to sortfromIndex - index of first element (inclusive) to sorttoIndex - index of last element (exclusive) to sortpublic static void sort(long[] a)
a - the array to sort
public static void sort(long[] a,
int fromIndex,
int toIndex)
a - the array to sortfromIndex - index of first element (inclusive) to sorttoIndex - index of last element (exclusive) to sortpublic static void sort(float[] a)
a - the array to sort
public static void sort(float[] a,
int fromIndex,
int toIndex)
a - the array to sortfromIndex - index of first element (inclusive) to sorttoIndex - index of last element (exclusive) to sortpublic static void sort(double[] a)
a - the array to sort
public static void sort(double[] a,
int fromIndex,
int toIndex)
a - the array to sortfromIndex - index of first element (inclusive) to sorttoIndex - index of last element (exclusive) to sortpublic static void sort(Object[] a)
a - the array to sort
public static void sort(Object[] a,
int fromIndex,
int toIndex)
a - the array to sortfromIndex - index of first element (inclusive) to sorttoIndex - index of last element (exclusive) to sortpublic static String toString(boolean[] a)
a - the array to convertpublic static String toString(byte[] a)
a - the array to convertpublic static String toString(short[] a)
a - the array to convertpublic static String toString(char[] a)
a - the array to convertpublic static String toString(int[] a)
a - the array to convertpublic static String toString(long[] a)
a - the array to convertpublic static String toString(float[] a)
a - the array to convertpublic static String toString(double[] a)
a - the array to convertpublic static String toString(Object[] a)
a - the array to convert
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||