public class Arrays2 extends Object
Modifier and Type | Method and Description |
---|---|
static void |
abs(byte[] data)
turns all values of the array to their absolute values
|
static void |
abs(double[] data)
turns all values of the array to their absolute values
|
static void |
abs(float[] data)
turns all values of the array to their absolute values
|
static void |
abs(int[] data)
turns all values of the array to their absolute values
|
static void |
abs(short[] data)
turns all values of the array to their absolute values
|
static void |
add(byte[] a,
byte b) |
static void |
add(byte[] a,
byte[] b)
adds b to a: a[i] += b[i]
Values of b won't be changed.
|
static void |
add(double[] a,
double b)
adds b to a: a[i] += b
|
static void |
add(double[] a,
double[] b)
adds b to a: a[i] += b[i]
Values of b won't be changed
|
static void |
add(float[] a,
double b) |
static void |
add(float[] a,
float[] b)
adds b to a: a[i] += b[i]
Values of b won't be changed
|
static void |
add(int[] a,
double b) |
static void |
add(int[] a,
int[] b)
adds b to a: a[i] += b[i]
Values of b won't be changed
|
static double[] |
append(byte[] a,
byte... b) |
static double[] |
append(double[] a,
double... b) |
static float[] |
append(float[] a,
float... b) |
static int[] |
append(int[] a,
int... b) |
static boolean |
contains(Object[] arr,
Object o)
checks whether an object o is contained in arr
|
static double[] |
convertToDouble(byte[] in) |
static double[] |
convertToDouble(float[] in) |
static double[] |
convertToDouble(int[] in) |
static double[] |
convertToDouble(short[] in) |
static double[] |
convertToDouble(String[] src)
Convert string array to doubles - replaces all non numerics with a NaN and throws a warning message to the logger
|
static double[] |
convertToDouble(String[] src,
double[] dst) |
static float[] |
convertToFloat(byte[] in) |
static float[] |
convertToFloat(double[] in) |
static float[] |
convertToFloat(int[] in) |
static float[] |
convertToFloat(String[] src)
Convert string array to doubles - replaces all non numerics with a NaN and throws a warning message to the logger
|
static float[] |
convertToFloat(String[] src,
float[] dst) |
static int[] |
convertToInt(byte[] in) |
static int[] |
convertToInt(double[] in) |
static int[] |
convertToInt(float[] in) |
static int[] |
convertToInt(String[] src)
Convert string array to doubles - replaces all non numerics with a 0 and throws a warning message to the logger
|
static int[] |
convertToInt(String[] src,
int[] dst) |
static double[] |
convolve(double[] in,
double[] out,
double[] kernel)
convolve an array with the specified kernel and write output into out
|
static float[] |
convolve(float[] in,
float[] out,
double[] kernel)
convolve n array with the specified kernel and write output into out
|
static int[] |
convolve(int[] in,
int[] out,
double[] kernel)
convolve an array with the specified kernel and write output into out
|
static void |
div(double[] data,
double factor)
divide array by a given value: data[i] /= factor
|
static void |
div(double[] data,
double[] factors)
divide array with values from other array: data[i] /= factors[i]
|
static void |
div(float[] data,
float factor)
divide array by a given value: data[i] /= factor
|
static void |
div(float[] data,
float[] factors)
divide array with values from other array: data[i] /= factors[i]
|
static double[] |
div(int[] data,
double factor,
double[] target)
divide an int array by a given value and write the result into a double array: target[i] = 1d * data[i] / factor;
|
static int |
findNaN(double[] in)
Finds the first NaN value in the given array.
|
static int |
indexOf(int[] src,
int o)
return first index of integer o in array a or -1 if the integer was not found
|
static int |
indexOf(Object[] src,
Object o)
return first index of Object o in array a or -1 if the object was not found
|
static String |
join(byte[] data,
String glue) |
static String |
join(double[] data,
String glue) |
static String |
join(double[] data,
String glue,
String formatString) |
static String |
join(double[] data,
String glue,
String formatString,
Locale locale)
Join array of objects by using a glue string and the Object's toString methods.
|
static String |
join(float[] data,
String glue) |
static String |
join(float[] data,
String glue,
int dec) |
static String |
join(int[] data,
Character glue) |
static String |
join(int[] data,
String glue) |
static String |
join(long[] arr,
Character glue) |
static String |
join(long[] arr,
String glue) |
static String |
join(long[] arr,
String glue,
Format f) |
static String |
join(Object[] arr,
Character glue) |
static String |
join(Object[] arr,
String glue)
join array of objects by using a glue string and the Object's toString methods.
|
static String |
join(Object[] arr,
String glue,
Format f)
join array of objects by using a glue string and a formatter object
|
static int |
max(byte[] a)
Find and return the INDEX with the greatest value.
|
static int |
max(double[] a)
Find and return the index with the greatest value.
|
static int |
max(float[] a)
Find and return the index with the greatest value.
|
static int |
max(int[] a)
Find and return the INDEX with the greatest value.
|
static double |
maxValue(double... a)
returns the greatest value
|
static double |
maxValue(int... a)
returns the largest value
|
static int |
min(byte[] a)
Finds and returns the INDEX with the least value.
|
static int |
min(double[] a)
Finds and returns the INDEX with the least value.
|
static int |
min(float[] a)
Finds and returns the index with the least value.
|
static int |
min(int[] a)
Finds and returns the index with the least value.
|
static double |
minValue(double... a)
returns the smallest value
|
static double |
minValue(int... a)
returns the smallest value
|
static void |
mul(double[] data,
double factor)
multilpy array with factor
|
static void |
mul(double[] data,
double[] factors)
multilpy array with factors from other array: data[i] *= factors[i]
|
static void |
mul(float[] data,
float factor)
multilpy array with factors from other array: data[i] *= factors[i]
|
static void |
mul(float[] data,
float[] factors)
multilpy array with factors from other array: data[i] *= factors[i]
|
static void |
replaceNaN(double[] arr,
double r)
replaces all NaNs and Infs with r
|
static void |
reverse(byte[] o) |
static void |
reverse(double[] o) |
static void |
reverse(float[] o) |
static void |
reverse(int[] o) |
static void |
reverse(Object[] o) |
static void |
sub(byte[] a,
byte[] b)
Performs a[i] = a[i]-b[i]
|
static void |
sub(double[] a,
double b) |
static void |
sub(double[] a,
double[] b)
Performs a[i] = a[i]-b[i]
|
static double[] |
sub(double[] a,
double[] b,
double[] out)
Performs out[i] = a[i]-b[i]
|
static void |
sub(float[] a,
float b) |
static void |
sub(float[] a,
float[] b)
Performs a[i] = a[i]-b[i]
|
static float[] |
sub(float[] a,
float[] b,
float[] out)
Performs out[i] = a[i]-b[i]
|
static void |
sub(int[] a,
double b) |
static int |
sum(byte[] a)
Returns the sum of all elements in this array
|
static double |
sum(double[] a)
Returns the sum of all elements in this array
|
static double |
sum(double[] arr,
int a,
int b)
Returns the sum of a subarray
|
static float |
sum(float[] a)
Returns the sum of all elements in this array
|
static double |
sum(float[] arr,
int a,
int b)
Returns the sum of a subarray
|
static double |
sum(int[] a)
Returns the sum of all elements in this array
|
static double |
sum(int[] arr,
int a,
int b)
Returns the sum of a subarray
|
static double[] |
unique(double[] arr)
Returns a new array with unique elements from the source array.
|
static double[] |
unique(double[] arr,
double accuracy)
Returns a new Array with unique elements from the source array.
|
static int[] |
unique(int[] arr) |
static Object[] |
unique(Object[] arr)
Returns a new Array with unique elements from the source array.
|
public static void abs(byte[] data)
data
- public static void abs(int[] data)
data
- public static void abs(float[] data)
data
- public static void abs(short[] data)
data
- public static void abs(double[] data)
data
- public static void reverse(Object[] o)
public static void reverse(double[] o)
public static void reverse(byte[] o)
public static void reverse(int[] o)
public static void reverse(float[] o)
public static Object[] unique(Object[] arr)
arr
- public static double[] unique(double[] arr)
arr
- public static int[] unique(int[] arr)
public static double[] unique(double[] arr, double accuracy)
arr
- accuracy
- defines the allowed distance up to which 2 doubles are equalpublic static String join(Object[] arr, String glue)
arr
- glue
- public static String join(Object[] arr, String glue, Format f)
arr
- glue
- f
- public static int indexOf(Object[] src, Object o)
src
- source arrayo
- object to searchpublic static int indexOf(int[] src, int o)
src
- source arrayo
- object to searchpublic static String join(byte[] data, String glue)
data
- glue
- data
separated by glue
join(java.lang.Object[], java.lang.String)
public static String join(int[] data, String glue)
data
- glue
- data
separated by glue
join(java.lang.Object[], java.lang.String)
public static String join(float[] data, String glue, int dec)
data
- glue
- data
separated by glue
, rounded to the
dec
th decimale placejoin(java.lang.Object[], java.lang.String)
public static String join(float[] data, String glue)
data
- glue
- data
separated by glue
, rounded to the
dec
th decimale placejoin(java.lang.Object[], java.lang.String)
public static String join(double[] data, String glue)
data
- glue
- data
separated by glue
join(java.lang.Object[], java.lang.String)
public static String join(double[] data, String glue, String formatString, Locale locale)
data
- glue
- formatString
- which formats a single element of the arraylocale
- Locale setting, may be null (defaults to US then)public static void mul(double[] data, double factor)
data
- source arrayfactor
- public static void mul(double[] data, double[] factors)
data
- source arrayfactors
- public static void mul(float[] data, float factor)
data
- source arrayfactor
- public static void mul(float[] data, float[] factors)
data
- source arrayfactors
- public static double[] div(int[] data, double factor, double[] target)
data
- source arrayfactor
- target
- the target array (may be null)public static void div(float[] data, float factor)
data
- source arrayfactor
- public static void div(float[] data, float[] factors)
data
- source arrayfactors
- public static void div(double[] data, double factor)
data
- source arrayfactor
- public static void div(double[] data, double[] factors)
data
- source arrayfactors
- public static void add(byte[] a, byte[] b)
a
- b
- public static void add(int[] a, int[] b)
a
- b
- public static void add(float[] a, float[] b)
a
- b
- public static void add(double[] a, double[] b)
a
- b
- public static void add(double[] a, double b)
a
- b
- public static void add(byte[] a, byte b)
public static void add(int[] a, double b)
public static void add(float[] a, double b)
public static double sum(double[] a)
a
- public static double sum(int[] a)
a
- public static float sum(float[] a)
a
- public static int sum(byte[] a)
a
- public static double sum(double[] arr, int a, int b)
arr
- the input arraya
- start index inclusiveb
- end index inclusivepublic static double sum(int[] arr, int a, int b)
arr
- the input arraya
- start index inclusiveb
- end index inclusivepublic static double sum(float[] arr, int a, int b)
arr
- the input arraya
- start index inclusiveb
- end index inclusivepublic static void sub(int[] a, double b)
public static void sub(double[] a, double b)
public static void sub(float[] a, float b)
public static void sub(byte[] a, byte[] b)
a
- b
- public static void sub(double[] a, double[] b)
a
- b
- public static void sub(float[] a, float[] b)
a
- b
- public static double[] sub(double[] a, double[] b, double[] out)
a
- b
- out
- containing a-bpublic static float[] sub(float[] a, float[] b, float[] out)
a
- b
- out
- containing a-bpublic static int[] convolve(int[] in, int[] out, double[] kernel)
in
- input array which will NOT be changedout
- output array with convolved valueskernel
- mask (odd size!)public static double[] convolve(double[] in, double[] out, double[] kernel)
in
- input array which will NOT be changedout
- output array with convolved values (may be null)kernel
- mask (odd size!)public static float[] convolve(float[] in, float[] out, double[] kernel)
in
- input array which will NOT be changedout
- output array with convolved valueskernel
- mask (odd size!)public static double[] append(byte[] a, byte... b)
public static double[] append(double[] a, double... b)
public static int[] append(int[] a, int... b)
public static float[] append(float[] a, float... b)
public static int max(double[] a)
a
- public static double maxValue(double... a)
a
- public static double maxValue(int... a)
a
- public static int max(int[] a)
a
- public static int max(byte[] a)
a
- public static int max(float[] a)
a
- public static int min(byte[] a)
a
- public static int min(double[] a)
a
- public static double minValue(double... a)
a
- public static double minValue(int... a)
a
- public static int min(int[] a)
a
- public static int min(float[] a)
a
- public static void replaceNaN(double[] arr, double r)
arr
- r
- public static boolean contains(Object[] arr, Object o)
arr
- o
- indexOf(java.lang.Object[], java.lang.Object)
public static int findNaN(double[] in)
in
- the array to be checkedpublic static double[] convertToDouble(byte[] in)
public static double[] convertToDouble(float[] in)
public static double[] convertToDouble(int[] in)
public static double[] convertToDouble(short[] in)
public static double[] convertToDouble(String[] src)
src
- double[]
for each entry in src
public static double[] convertToDouble(String[] src, double[] dst)
public static float[] convertToFloat(byte[] in)
public static float[] convertToFloat(double[] in)
public static float[] convertToFloat(int[] in)
public static float[] convertToFloat(String[] src)
src
- double[]
for each entry in src
public static float[] convertToFloat(String[] src, float[] dst)
public static int[] convertToInt(byte[] in)
public static int[] convertToInt(double[] in)
public static int[] convertToInt(float[] in)
public static int[] convertToInt(String[] src)
src
- double[]
for each entry in src
public static int[] convertToInt(String[] src, int[] dst)
Copyright © 2013. All Rights Reserved.