|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectArrayUtils
public class ArrayUtils
Static utility methods acting on arrays of primitive types.
Constructor Summary | |
---|---|
ArrayUtils()
|
Method Summary | |
---|---|
static int |
count(boolean[] vals,
boolean val)
Returns the number of occurrences of the given value in the given array. |
static int[] |
cumProd(int[] vals)
Returns the cumulative product of the given array. |
static long[] |
cumProd(long[] vals)
|
static long[] |
cumProdAsLong(int[] vals)
|
static BigInteger |
cumProdLastBigInteger(int[] vals)
|
static long |
cumProdLastLong(int[] vals)
|
static double |
intervalSum(double[] vals,
int start,
int bound)
Returns the sum of the given consecutive range of values in the given array. |
static double |
max(double[] vals)
Returns the maximum of the values in the given array. |
static int |
max(int[] vals)
Returns the maximum of the values in the given array. |
static int |
maxInd(double[] vals)
Returns the index of the maximum value in the given array. |
static int |
maxInd(int[] vals)
Returns the index of the maximum value in the given array. |
static double |
min(double[] vals)
Returns the minimum of the values in the given array. |
static int |
min(int[] vals)
Returns the minimum of the values in the given array. |
static int |
minInd(double[] vals)
Returns the index of the minimum value in the given array. |
static int |
minInd(int[] vals)
Returns the index of the minimum value in the given array. |
static int[] |
reversed(int[] vals)
Returns an array that contains the same values as the given array but reversed. |
static double[] |
select(double[] vals,
int[] inds)
Returns an array that contains selected values from the given array. |
static int[] |
select(int[] vals,
int[] inds)
Returns an array that contains selected values from the given array. |
static long[] |
select(long[] vals,
int[] inds)
|
static double[] |
selectWithOffset(double[] vals,
int[] inds,
int offset)
Returns an array that contains selected values from the given array. |
static void |
selectWithOffset(double[] vals,
int[] inds,
int offset,
double[] dest)
Fills an array with selected values from the given array. |
static int[] |
sequence(int len)
Returns an array of ints [0, 1, 2, ..., L - 1], where L is the given length. |
static int[] |
sortedInds(double[] vals)
Returns an array of indices of the the values in the given array sorted according to the values they index. |
static int[] |
sortedInds(int[] vals)
Returns an array of indices of the the values in the given array sorted according to the values they index. |
static double |
sum(double[] vals)
Returns the sum of the values in the given array. |
static double[] |
toDoubles(int[] vals)
Returns an array of doubles containing the same values as the given array of ints. |
static int[] |
toInts(double[] vals)
Returns an array of ints containing the same values as the given array of doubles after the double values are rounded. |
static String |
toString(double[] vals)
Returns a string representation of the given array. |
static String |
toString(int[] vals)
Returns a string representation of the given array. |
Methods inherited from class Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ArrayUtils()
Method Detail |
---|
public static int[] cumProd(int[] vals)
vals
- the given array.
public static long[] cumProdAsLong(int[] vals)
public static long[] cumProd(long[] vals)
public static long cumProdLastLong(int[] vals)
public static BigInteger cumProdLastBigInteger(int[] vals)
public static int[] select(int[] vals, int[] inds)
vals
- the given array.inds
- the indices of the values to select.
public static double[] select(double[] vals, int[] inds)
vals
- the given array.inds
- the indices of the values to select.
public static long[] select(long[] vals, int[] inds)
public static void selectWithOffset(double[] vals, int[] inds, int offset, double[] dest)
vals
- the given array.inds
- the indices, which together with offset, define the values
to select.offset
- the value, which together with indices, defines the values
to select.public static double[] selectWithOffset(double[] vals, int[] inds, int offset)
vals
- the given array.inds
- the indices, which together with offset, define the values
to select.offset
- the value, which together with indices, defines the values
to select.
public static String toString(int[] vals)
vals
- the given array.
public static String toString(double[] vals)
vals
- the given array.
public static int count(boolean[] vals, boolean val)
vals
- the given array.val
- the given value.
public static double sum(double[] vals)
vals
- the given array.
public static double intervalSum(double[] vals, int start, int bound)
vals
- the given array.start
- the first element to sum (inclusive).bound
- the last element to sum (exclusive).
public static int min(int[] vals)
vals
- the given array.
public static int max(int[] vals)
vals
- the given array.
public static int minInd(int[] vals)
vals
- the given array.
public static int maxInd(int[] vals)
vals
- the given array.
public static double min(double[] vals)
vals
- the given array.
public static double max(double[] vals)
vals
- the given array.
public static int minInd(double[] vals)
vals
- the given array.
public static int maxInd(double[] vals)
vals
- the given array.
public static double[] toDoubles(int[] vals)
vals
- the given array of ints.
public static int[] toInts(double[] vals)
vals
- the given array of doubles.
public static int[] sortedInds(double[] vals)
vals
- the given array.
public static int[] sortedInds(int[] vals)
vals
- the given array.
public static int[] reversed(int[] vals)
vals
- the given array.
public static int[] sequence(int len)
len
- the given length.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |