|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnl.knowledgeplaza.util.ArrayUtil
public class ArrayUtil
This class contains several Array helper methods.
| Field Summary | |
|---|---|
static String |
SOURCECODE_VERSION
Standard variable for determining version of a class file. |
| Constructor Summary | |
|---|---|
ArrayUtil()
|
|
| Method Summary | |
|---|---|
static byte[] |
concat(byte[] a,
byte[] b)
Create a new byte array with holds the contents of a follow by b |
static String |
deepToString(Object[] a)
Returns a string representation of the "deep contents" of the specified array. |
static int |
indexOf(byte[] haystack,
byte[] needle)
Find a needle in a haystack. |
static int |
indexOf(byte[] haystack,
byte[] needle,
int startAt)
Find a needle in a haystack. |
static void |
main(String[] args)
|
static byte[] |
subarray(byte[] data,
int begin,
int end)
Make a subarray. |
static String |
toString(boolean[] a)
Returns a string representation of the contents of the specified array. |
static String |
toString(byte[] a)
Returns a string representation of the contents of the specified array. |
static String |
toString(char[] a)
Returns a string representation of the contents of the specified array. |
static String |
toString(double[] a)
Returns a string representation of the contents of the specified array. |
static String |
toString(float[] a)
Returns a string representation of the contents of the specified array. |
static String |
toString(int[] a)
Returns a string representation of the contents of the specified array. |
static String |
toString(long[] a)
Returns a string representation of the contents of the specified array. |
static String |
toString(Object[] a)
Returns a string representation of the contents of the specified array. |
static String |
toString(short[] a)
Returns a string representation of the contents of the specified array. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String SOURCECODE_VERSION
| Constructor Detail |
|---|
public ArrayUtil()
| Method Detail |
|---|
public static int indexOf(byte[] haystack,
byte[] needle)
haystack - needle -
public static int indexOf(byte[] haystack,
byte[] needle,
int startAt)
haystack - needle - startAt -
public static byte[] subarray(byte[] data,
int begin,
int end)
data - the arraybegin - end -
public static byte[] concat(byte[] a,
byte[] b)
a - b -
public static String toString(long[] a)
a - the array whose string representation to return
public static String toString(int[] a)
a - the array whose string representation to return
public static String toString(short[] a)
a - the array whose string representation to return
public static String toString(char[] a)
a - the array whose string representation to return
public static String toString(byte[] a)
a - the array whose string representation to return
public static String toString(boolean[] a)
a - the array whose string representation to return
public static String toString(float[] a)
a - the array whose string representation to return
public static String toString(double[] a)
a - the array whose string representation to return
public static String toString(Object[] a)
Object.toString() method inherited from
Object, which describes their identities rather than
their contents.
The value returned by this method is equal to the value that would be returned by Arrays.asList(a).toString(), unless a is null, in which case "null" is returned.
a - the array whose string representation to return
deepToString(Object[])public static String deepToString(Object[] a)
The string representation consists of a list of the array's elements, enclosed in square brackets ("{}"). Adjacent elements are separated by the characters ", " (a comma followed by a space). Elements are converted to strings as by String.valueOf(Object), unless they are themselves arrays.
If an element e is an array of a primitive type, it is converted to a string as by invoking the appropriate overloading of Arrays.toString(e). If an element e is an array of a reference type, it is converted to a string as by invoking this method recursively.
To avoid infinite recursion, if the specified array contains itself as an element, or contains an indirect reference to itself through one or more levels of arrays, the self-reference is converted to the string "{...}". For example, an array containing only a reference to itself would be rendered as "{[...]}".
This method returns "null" if the specified array is null.
a - the array whose string representation to return
toString(Object[])public static void main(String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||