public abstract class ArrayCopyUtilities
extends java.lang.Object
A class of static methods for copying data between arrays of different types, expanding arrays, and comparing them, and removing padding from strings.
Constructor and Description |
---|
ArrayCopyUtilities() |
Modifier and Type | Method and Description |
---|---|
static boolean |
arraysAreEqual(double[] a1,
double[] a2)
Compare two double arrays and return true if both not null, and are of equal length and contain equal values.
|
static double[] |
copyFloatToDoubleArray(float[] src)
Copy an array of float values into an array of double.
|
static double[] |
copySignedIntToDoubleArray(int[] src)
Copy an array of signed values in int, into an array of double.
|
static float[] |
copySignedIntToFloatArray(int[] src)
Copy an array of signed values in int, into an array of float.
|
static long[] |
copySignedIntToLongArray(int[] src)
Copy an array of signed values in int, into an array of long.
|
static short[] |
copySignedIntToShortArray(int[] src)
Copy an array of signed values in int, into an array of short.
|
static double[] |
copySignedLongToDoubleArray(long[] src)
Copy an array of signed values in long, into an array of double.
|
static float[] |
copySignedLongToFloatArray(long[] src)
Copy an array of signed values in long, into an array of float.
|
static int[] |
copySignedLongToIntArray(long[] src)
Copy an array of signed values in long, into an array of int.
|
static short[] |
copySignedLongToShortArray(long[] src)
Copy an array of signed values in long, into an array of short.
|
static double[] |
copySignedShortToDoubleArray(short[] src)
Copy an array of signed values in short, into an array of double.
|
static float[] |
copySignedShortToFloatArray(short[] src)
Copy an array of signed values in short, into an array of float.
|
static int[] |
copySignedShortToIntArray(short[] src)
Copy an array of signed values in short, into an array of int.
|
static long[] |
copySignedShortToLongArray(short[] src)
Copy an array of signed values in short, into an array of long.
|
static java.lang.String[] |
copyStringArrayRemovingLeadingAndTrailingPadding(java.lang.String[] src)
Copy a string removing leading and trailing padding.
|
static double[] |
copyStringToDoubleArray(java.lang.String[] src)
Extract decimal values from an array of strings into an array of double.
|
static float[] |
copyStringToFloatArray(java.lang.String[] src)
Extract decimal values from an array of strings into an array of float.
|
static int[] |
copyStringToIntArray(java.lang.String[] src)
Extract integer values from an array of strings into an array of int.
|
static long[] |
copyStringToLongArray(java.lang.String[] src)
Extract long values from an array of strings into an array of int.
|
static short[] |
copyStringToShortArray(java.lang.String[] src)
Extract short values from an array of strings into an array of short.
|
static double[] |
copyUnsignedIntToDoubleArray(int[] src)
Copy an array of unsigned values in int, into an array of double.
|
static float[] |
copyUnsignedIntToFloatArray(int[] src)
Copy an array of unsigned values in int, into an array of float.
|
static long[] |
copyUnsignedIntToLongArray(int[] src)
Copy an array of unsigned values in int, into an array of long.
|
static short[] |
copyUnsignedIntToShortArray(int[] src)
Copy an array of unsigned values in int, into an array of short.
|
static double[] |
copyUnsignedLongToDoubleArray(long[] src)
Copy an array of unsigned values in long, into an array of double.
|
static float[] |
copyUnsignedLongToFloatArray(long[] src)
Copy an array of unsigned values in long, into an array of float.
|
static int[] |
copyUnsignedLongToIntArray(long[] src)
Copy an array of unsigned values in long, into an array of int.
|
static short[] |
copyUnsignedLongToShortArray(long[] src)
Copy an array of unsigned values in long, into an array of short.
|
static double[] |
copyUnsignedShortToDoubleArray(short[] src)
Copy an array of unsigned values in short, into an array of double.
|
static float[] |
copyUnsignedShortToFloatArray(short[] src)
Copy an array of unsigned values in short, into an array of float.
|
static int[] |
copyUnsignedShortToIntArray(short[] src)
Copy an array of unsigned values in short, into an array of int.
|
static long[] |
copyUnsignedShortToLongArray(short[] src)
Copy an array of unsigned values in short, into an array of long.
|
static double[] |
expandArray(double[] src)
Expand an array by adding one element to the end.
|
static double[] |
expandArray(double[] src,
int expandBy)
Expand an array by adding elements to the end.
|
static float[] |
expandArray(float[] src)
Expand an array by adding one element to the end.
|
static float[] |
expandArray(float[] src,
int expandBy)
Expand an array by adding elements to the end.
|
static int[] |
expandArray(int[] src)
Expand an array by adding one element to the end.
|
static int[] |
expandArray(int[] src,
int expandBy)
Expand an array by adding elements to the end.
|
static long[] |
expandArray(long[] src)
Expand an array by adding one element to the end.
|
static long[] |
expandArray(long[] src,
int expandBy)
Expand an array by adding elements to the end.
|
static short[] |
expandArray(short[] src)
Expand an array by adding one element to the end.
|
static short[][] |
expandArray(short[][] src)
Expand an array by adding one element to the end.
|
static short[][] |
expandArray(short[][] src,
int expandBy)
Expand an array by adding elements to the end.
|
static short[] |
expandArray(short[] src,
int expandBy)
Expand an array by adding elements to the end.
|
static java.lang.String[] |
expandArray(java.lang.String[] src)
Expand an array by adding one element to the end.
|
static java.lang.String[] |
expandArray(java.lang.String[] src,
int expandBy)
Expand an array by adding elements to the end.
|
static double[] |
minMax(double[] array)
Find the minimum and maximum values in an array.
|
static float[] |
minMax(float[] array)
Find the minimum and maximum values in an array.
|
static short[] |
packByteArrayIntoShortArrayLittleEndian(byte[] src)
Pack an array of byte values into an array of short.
|
public static boolean arraysAreEqual(double[] a1, double[] a2)
Compare two double arrays and return true if both not null, and are of equal length and contain equal values.
a1
- first arraya2
- second arraypublic static double[] copyFloatToDoubleArray(float[] src)
Copy an array of float values into an array of double.
src
- an array of floatpublic static double[] copySignedIntToDoubleArray(int[] src)
Copy an array of signed values in int, into an array of double.
Sign extension is performed.
src
- an array of int, whose values are interpreted as signedpublic static float[] copySignedIntToFloatArray(int[] src)
Copy an array of signed values in int, into an array of float.
Sign extension is performed.
src
- an array of int, whose values are interpreted as signedpublic static long[] copySignedIntToLongArray(int[] src)
Copy an array of signed values in int, into an array of long.
Sign extension is performed.
src
- an array of int, whose values are interpreted as signedpublic static short[] copySignedIntToShortArray(int[] src)
Copy an array of signed values in int, into an array of short.
The value is truncated as necessary.
src
- an array of intpublic static double[] copySignedLongToDoubleArray(long[] src)
Copy an array of signed values in long, into an array of double.
Sign extension is performed.
src
- an array of long, whose values are interpreted as signedpublic static float[] copySignedLongToFloatArray(long[] src)
Copy an array of signed values in long, into an array of float.
Sign extension is performed.
src
- an array of long, whose values are interpreted as signedpublic static int[] copySignedLongToIntArray(long[] src)
Copy an array of signed values in long, into an array of int.
The values are truncated as necessary.
src
- an array of long, whose values are interpreted as signedpublic static short[] copySignedLongToShortArray(long[] src)
Copy an array of signed values in long, into an array of short.
The values are truncated as necessary.
src
- an array of longpublic static double[] copySignedShortToDoubleArray(short[] src)
Copy an array of signed values in short, into an array of double.
Sign extension is performed.
src
- an array of short, whose values are interpreted as signedpublic static float[] copySignedShortToFloatArray(short[] src)
Copy an array of signed values in short, into an array of float.
Sign extension is performed.
src
- an array of short, whose values are interpreted as signedpublic static int[] copySignedShortToIntArray(short[] src)
Copy an array of signed values in short, into an array of int.
Sign extension is performed.
src
- an array of short, whose values are interpreted as signedpublic static long[] copySignedShortToLongArray(short[] src)
Copy an array of signed values in short, into an array of long.
Sign extension is performed.
src
- an array of short, whose values are interpreted as signedpublic static java.lang.String[] copyStringArrayRemovingLeadingAndTrailingPadding(java.lang.String[] src)
Copy a string removing leading and trailing padding.
src
- the padded valuepublic static double[] copyStringToDoubleArray(java.lang.String[] src)
Extract decimal values from an array of strings into an array of double.
Exceptions in the format of the string are trapped and 0 value(s) returned.
src
- an array of strings, each of which should be a decimal numeric valuepublic static float[] copyStringToFloatArray(java.lang.String[] src)
Extract decimal values from an array of strings into an array of float.
Exceptions in the format of the string are trapped and 0 value(s) returned.
src
- an array of strings, each of which should be a decimal numeric valuepublic static int[] copyStringToIntArray(java.lang.String[] src)
Extract integer values from an array of strings into an array of int.
Exceptions in the format of the string are trapped and 0 value(s) returned.
src
- an array of strings, each of which should be an integer numeric valuepublic static long[] copyStringToLongArray(java.lang.String[] src)
Extract long values from an array of strings into an array of int.
Exceptions in the format of the string are trapped and 0 value(s) returned.
src
- an array of strings, each of which should be an long numeric valuepublic static short[] copyStringToShortArray(java.lang.String[] src)
Extract short values from an array of strings into an array of short.
Exceptions in the format of the string are trapped and 0 value(s) returned.
src
- an array of strings, each of which should be a short numeric valuepublic static double[] copyUnsignedIntToDoubleArray(int[] src)
Copy an array of unsigned values in int, into an array of double.
Sign extension is prevented.
src
- an array of int, whose values are interpreted as unsignedpublic static float[] copyUnsignedIntToFloatArray(int[] src)
Copy an array of unsigned values in int, into an array of float.
Sign extension is prevented.
src
- an array of int, whose values are interpreted as unsignedpublic static long[] copyUnsignedIntToLongArray(int[] src)
Copy an array of unsigned values in int, into an array of long.
Sign extension is prevented.
src
- an array of int, whose values are interpreted as unsignedpublic static short[] copyUnsignedIntToShortArray(int[] src)
Copy an array of unsigned values in int, into an array of short.
The value is truncated as necessary.
src
- an array of intpublic static double[] copyUnsignedLongToDoubleArray(long[] src)
Copy an array of unsigned values in long, into an array of double.
Sign extension cannot be prevented since Java has no unsigned long type.
src
- an array of int, whose values are interpreted as unsignedpublic static float[] copyUnsignedLongToFloatArray(long[] src)
Copy an array of unsigned values in long, into an array of float.
Sign extension cannot be prevented since Java has no unsigned long type.
src
- an array of long, whose values are interpreted as unsignedpublic static int[] copyUnsignedLongToIntArray(long[] src)
Copy an array of unsigned values in long, into an array of int.
The values are truncated as necessary.
src
- an array of long, whose values are interpreted as unsignedpublic static short[] copyUnsignedLongToShortArray(long[] src)
Copy an array of unsigned values in long, into an array of short.
The values are truncated as necessary.
src
- an array of longpublic static double[] copyUnsignedShortToDoubleArray(short[] src)
Copy an array of unsigned values in short, into an array of double.
Sign extension is prevented.
src
- an array of short, whose values are interpreted as unsignedpublic static float[] copyUnsignedShortToFloatArray(short[] src)
Copy an array of unsigned values in short, into an array of float.
Sign extension is prevented.
src
- an array of short, whose values are interpreted as unsignedpublic static int[] copyUnsignedShortToIntArray(short[] src)
Copy an array of unsigned values in short, into an array of int.
Sign extension is prevented.
src
- an array of short, whose values are interpreted as unsignedpublic static long[] copyUnsignedShortToLongArray(short[] src)
Copy an array of unsigned values in short, into an array of long.
Sign extension is prevented.
src
- an array of short, whose values are interpreted as unsignedpublic static double[] expandArray(double[] src)
Expand an array by adding one element to the end.
src
- an arraypublic static double[] expandArray(double[] src, int expandBy)
Expand an array by adding elements to the end.
src
- an arrayexpandBy
- the number of elements to addpublic static float[] expandArray(float[] src)
Expand an array by adding one element to the end.
src
- an arraypublic static float[] expandArray(float[] src, int expandBy)
Expand an array by adding elements to the end.
src
- an arrayexpandBy
- the number of elements to addpublic static int[] expandArray(int[] src)
Expand an array by adding one element to the end.
src
- an arraypublic static int[] expandArray(int[] src, int expandBy)
Expand an array by adding elements to the end.
src
- an arrayexpandBy
- the number of elements to addpublic static long[] expandArray(long[] src)
Expand an array by adding one element to the end.
src
- an arraypublic static long[] expandArray(long[] src, int expandBy)
Expand an array by adding elements to the end.
src
- an arrayexpandBy
- the number of elements to addpublic static short[] expandArray(short[] src)
Expand an array by adding one element to the end.
src
- an arraypublic static short[][] expandArray(short[][] src)
Expand an array by adding one element to the end.
src
- an arraypublic static short[][] expandArray(short[][] src, int expandBy)
Expand an array by adding elements to the end.
src
- an arrayexpandBy
- the number of elements to addpublic static short[] expandArray(short[] src, int expandBy)
Expand an array by adding elements to the end.
src
- an arrayexpandBy
- the number of elements to addpublic static java.lang.String[] expandArray(java.lang.String[] src)
Expand an array by adding one element to the end.
src
- an arraypublic static java.lang.String[] expandArray(java.lang.String[] src, int expandBy)
Expand an array by adding elements to the end.
src
- an arrayexpandBy
- the number of elements to addpublic static double[] minMax(double[] array)
Find the minimum and maximum values in an array.
array
- the arraypublic static float[] minMax(float[] array)
Find the minimum and maximum values in an array.
array
- the arraypublic static short[] packByteArrayIntoShortArrayLittleEndian(byte[] src)
Pack an array of byte values into an array of short.
Order is little endian (first byte into low order byte of short.
src
- an array of byte