public class IntArray extends IntegerArray
int[].| Constructor and Description |
|---|
IntArray() |
| Modifier and Type | Method and Description |
|---|---|
static int |
average(int[] ary)
Returns the average of the elements in array, or 0 if null or the number of elements is zero.
|
static boolean |
contains(int[] ary,
int value)
Returns whether the given value equals any element in the array.
|
int |
getInt(int index) |
int |
getInt(int index,
int defValue) |
static int |
length(int[] ary)
Returns the number of elements in the array, or 0 if null.
|
static int |
max(int[] ary)
Returns the maximum in the array, or Integer.MIN_VALUE if null.
|
static int |
min(int[] ary)
Returns the minimum in the array, or Integer.MAX_VALUE if null.
|
static int |
sum(int[] ary)
Returns the sum (total) of array, or 0 if null.
|
static java.lang.String[] |
toStringArray(int[] ary)
Returns an array of strings for the given int array, or an zero-length string array if the
int array is null or empty.
|
public int getInt(int index,
int defValue)
public int getInt(int index)
public static java.lang.String[] toStringArray(int[] ary)
ary - the array to convertpublic static boolean contains(int[] ary,
int value)
ary - the array to searchvalue - the value to match an element againstvaluepublic static int max(int[] ary)
ary - the array of which to find the maximumpublic static int min(int[] ary)
ary - the array of which to find the minimumpublic static int sum(int[] ary)
ary - the array to sumpublic static int length(int[] ary)
ary - the arraypublic static int average(int[] ary)
ary - the array of integers to take the average of