public class ArrayTools
extends Object
Specific methods are created for each primitive type, so as to completely avoid causing any primitive-to-object-to-primitive overhead. Additionally all non-primitive types are supported without any need to utilize unsafe type-casting thanks to the behind-the-scenes magic of Java's Generics.
Modifier and Type | Field and Description |
---|---|
static String |
VERSION
Version number of this Package (read-only).
|
Modifier and Type | Method and Description |
---|---|
static boolean |
contains(boolean[] array,
boolean element)
Determines if an array contains a specific element.
|
static boolean |
contains(byte[] array,
byte element)
Determines if an array contains a specific element.
|
static boolean |
contains(char[] array,
char element)
Determines if an array contains a specific element.
|
static boolean |
contains(double[] array,
double element)
Determines if an array contains a specific element.
|
static boolean |
contains(float[] array,
float element)
Determines if an array contains a specific element.
|
static boolean |
contains(int[] array,
int element)
Determines if an array contains a specific element.
|
static boolean |
contains(long[] array,
long element)
Determines if an array contains a specific element.
|
static boolean |
contains(short[] array,
short element)
Determines if an array contains a specific element.
|
static <Type> boolean |
contains(Type[] array,
Type element)
Determines if an array contains a specific element using the respective
equals() method to perform the comparison.
|
static boolean[] |
copy(boolean[] src,
int begin,
int length)
Copies a portion of an array to a new array of the exact required size.
|
static boolean[] |
copy(boolean[] src,
int begin,
int length,
int size)
Copies a portion of an array to a new array of the exact required size,
which may be larger than what is actually needed.
|
static byte[] |
copy(byte[] src,
int begin,
int length)
Copies a portion of an array to a new array of the exact required size.
|
static byte[] |
copy(byte[] src,
int begin,
int length,
int size)
Copies a portion of an array to a new array of the exact required size,
which may be larger than what is actually needed.
|
static char[] |
copy(char[] src,
int begin,
int length)
Copies a portion of an array to a new array of the exact required size.
|
static char[] |
copy(char[] src,
int begin,
int length,
int size)
Copies a portion of an array to a new array of the exact required size,
which may be larger than what is actually needed.
|
static double[] |
copy(double[] src,
int begin,
int length)
Copies a portion of an array to a new array of the exact required size.
|
static double[] |
copy(double[] src,
int begin,
int length,
int size)
Copies a portion of an array to a new array of the exact required size,
which may be larger than what is actually needed.
|
static float[] |
copy(float[] src,
int begin,
int length)
Copies a portion of an array to a new array of the exact required size.
|
static float[] |
copy(float[] src,
int begin,
int length,
int size)
Copies a portion of an array to a new array of the exact required size,
which may be larger than what is actually needed.
|
static int[] |
copy(int[] src,
int begin,
int length)
Copies a portion of an array to a new array of the exact required size.
|
static int[] |
copy(int[] src,
int begin,
int length,
int size)
Copies a portion of an array to a new array of the exact required size,
which may be larger than what is actually needed.
|
static long[] |
copy(long[] src,
int begin,
int length)
Copies a portion of an array to a new array of the exact required size.
|
static long[] |
copy(long[] src,
int begin,
int length,
int size)
Copies a portion of an array to a new array of the exact required size,
which may be larger than what is actually needed.
|
static short[] |
copy(short[] src,
int begin,
int length)
Copies a portion of an array to a new array of the exact required size.
|
static short[] |
copy(short[] src,
int begin,
int length,
int size)
Copies a portion of an array to a new array of the exact required size,
which may be larger than what is actually needed.
|
static <Type> Type[] |
copy(Type[] src,
int begin,
int length)
Copies a portion of an array to a new array of the exact required size.
|
static <Type> Type[] |
copy(Type[] src,
int begin,
int length,
int size)
Copies a portion of an array to a new array of the exact required size,
which may be larger than what is actually needed.
|
static <Type> HashMap<Type,Type> |
createHashMap(Type... pairs)
Creates a HashMap from an array of objects where both the Key and the
Value are the same class (e.g., String). This method makes it really
easy to create a HashMap (a very nice aspect of Perl's syntax).
|
static String |
hex(boolean[] array)
Converts an array of booleans into an unformatted hexadecimal string.
|
static String |
hex(byte[] array)
Converts an array of bytes into an unformatted hexadecimal string.
|
static String |
hex(char[] array)
Converts an array of characters into an unformatted hexadecimal string.
|
static String |
hex(double[] array)
Converts an array of doubles into an unformatted hexadecimal string.
|
static String |
hex(float[] array)
Converts an array of floats into an unformatted hexadecimal string.
|
static String |
hex(int[] array)
Converts an array of integers into an unformatted hexadecimal string.
|
static String |
hex(long[] array)
Converts an array of long integers into an unformatted hexadecimal
string.
|
static String |
hex(short[] array)
Converts an array of short integers into an unformatted hexadecimal
string.
|
static <Type> String |
hex(Type[] array)
Converts an array of objects into an unformatted hexadecimal string using
the given object's built-in toString() method.
|
static int |
index(boolean[] array,
boolean element)
Identifies the first instance of an element in an array.
|
static int |
index(byte[] array,
byte element)
Identifies the first instance of an element in an array.
|
static int |
index(char[] array,
char element)
Identifies the first instance of an element in an array.
|
static int |
index(double[] array,
double element)
Identifies the first instance of an element in an array.
|
static int |
index(float[] array,
float element)
Identifies the first instance of an element in an array.
|
static int |
index(int[] array,
int element)
Identifies the first instance of an element in an array.
|
static int |
index(long[] array,
long element)
Identifies the first instance of an element in an array.
|
static int |
index(short[] array,
short element)
Identifies the first instance of an element in an array.
|
static <Type> int |
index(Type[] array,
Type element)
Identifies the first instance of an element in an array using the
equals() method to perform the comparison.
|
static boolean[] |
join(boolean[]... array)
Joins any number of arrays.
|
static byte[] |
join(byte[]... array)
Joins any number of arrays.
|
static char[] |
join(char[]... array)
Joins any number of arrays.
|
static double[] |
join(double[]... array)
Joins any number of arrays.
|
static float[] |
join(float[]... array)
Joins any number of arrays.
|
static int[] |
join(int[]... array)
Joins any number of arrays.
|
static long[] |
join(long[]... array)
Joins any number of arrays.
|
static short[] |
join(short[]... array)
Joins any number of arrays.
|
static <Type> Type[] |
join(Type[]... array)
Joins any number of arrays. All NULL arrays are skipped to prevent
a java.lang.NullPointerException exception.
|
static long |
length(String... src)
Measures the combined length, in bytes, of all elements in an array.
All "null" elements will not be measured (effectively measured at 0 bytes).
|
static long |
length(StringBuilder... src)
Measures the combined length, in bytes, of all elements in an array.
All "null" elements will not be measured (effectively measured at 0 bytes).
|
static boolean |
max(boolean[] array)
Returns the maximum value in an array.
|
static byte |
max(byte[] array)
Returns the maximum value in an array.
|
static char |
max(char[] array)
Returns the maximum value in an array.
|
static double |
max(double[] array)
Returns the maximum value in an array.
|
static float |
max(float[] array)
Returns the maximum value in an array.
|
static int |
max(int[] array)
Returns the maximum value in an array.
|
static long |
max(long[] array)
Returns the maximum value in an array.
|
static short |
max(short[] array)
Returns the maximum value in an array.
|
static <Type> Type |
max(Type[] array)
Returns the maximum HashCode value in an array.
|
static boolean |
min(boolean[] array)
Returns the minimum value in an array.
|
static byte |
min(byte[] array)
Returns the minimum value in an array.
|
static char |
min(char[] array)
Returns the minimum value in an array.
|
static double |
min(double[] array)
Returns the minimum value in an array.
|
static float |
min(float[] array)
Returns the minimum value in an array.
|
static int |
min(int[] array)
Returns the minimum value in an array.
|
static long |
min(long[] array)
Returns the minimum value in an array.
|
static <Type> Type |
min(Type[] array)
Returns the minimum value in an array.
|
static boolean[] |
removeNULLs(Boolean[] array)
Returns a possibly shorter array with all NULL entries removed.
|
static byte[] |
removeNULLs(Byte[] array)
Returns a possibly shorter array with all NULL entries removed.
|
static char[] |
removeNULLs(Character[] array)
Returns a possibly shorter array with all NULL entries removed.
|
static double[] |
removeNULLs(Double[] array)
Returns a possibly shorter array with all NULL entries removed.
|
static float[] |
removeNULLs(Float[] array)
Returns a possibly shorter array with all NULL entries removed.
|
static int[] |
removeNULLs(Integer[] array)
Returns a possibly shorter array with all NULL entries removed.
|
static long[] |
removeNULLs(Long[] array)
Returns a possibly shorter array with all NULL entries removed.
|
static short[] |
removeNULLs(Short[] array)
Returns a possibly shorter array with all NULL entries removed.
|
static <Type> Type[] |
removeNULLs(Type[] array)
Returns a possibly shorter array with all NULL entries removed.
|
static boolean[] |
resize(boolean[] array,
int n)
Constructs a new array based on the array provided, and with n
elements.
|
static byte[] |
resize(byte[] array,
int n)
Constructs a new array based on the array provided, and with n
elements.
|
static char[] |
resize(char[] array,
int n)
Constructs a new array based on the array provided, and with n
elements.
|
static double[] |
resize(double[] array,
int n)
Constructs a new array based on the array provided, and with n
elements.
|
static float[] |
resize(float[] array,
int n)
Constructs a new array based on the array provided, and with n
elements.
|
static int[] |
resize(int[] array,
int n)
Constructs a new array based on the array provided, and with n
elements.
|
static long[] |
resize(long[] array,
int n)
Constructs a new array based on the array provided, and with n
elements.
|
static short[] |
resize(short[] array,
int n)
Constructs a new array based on the array provided, and with n
elements.
|
static <Type> Type[] |
resize(Type[] array,
int n)
Constructs a new array based on the array provided, and with n
elements.
|
public static final String VERSION
public static boolean contains(boolean[] array, boolean element)
array
- The array to searchelement
- The element to search forpublic static boolean contains(byte[] array, byte element)
array
- The array to searchelement
- The element to search forpublic static boolean contains(char[] array, char element)
array
- The array to searchelement
- The element to search forpublic static boolean contains(double[] array, double element)
array
- The array to searchelement
- The element to search forpublic static boolean contains(float[] array, float element)
array
- The array to searchelement
- The element to search forpublic static boolean contains(int[] array, int element)
array
- The array to searchelement
- The element to search forpublic static boolean contains(long[] array, long element)
array
- The array to searchelement
- The element to search forpublic static boolean contains(short[] array, short element)
array
- The array to searchelement
- The element to search forpublic static <Type> boolean contains(Type[] array, Type element)
array
- The array to searchelement
- The element to search forpublic static boolean[] copy(boolean[] src, int begin, int length)
Note: If the size of the source array is smaller than the specified length, then a runtime java.lang.ArrayIndexOutOfBoundsException will be thrown (in accordance with logical expectation).
source
- The source array to copy elements frombegin
- Element to begin copying from (0 = first element)length
- Number of elements to copy from the source arraypublic static boolean[] copy(boolean[] src, int begin, int length, int size)
Note: If the size of the source array is smaller than the specified length, then a runtime java.lang.ArrayIndexOutOfBoundsException will be thrown (in accordance with logical expectation).
source
- The source array to copy elements frombegin
- Element to begin copying from (0 = first element)length
- Number of elements to copy from the source arraysize
- Overrides the "length" parameter if larger than length specifiedpublic static byte[] copy(byte[] src, int begin, int length)
Note: If the size of the source array is smaller than the specified length, then a runtime java.lang.ArrayIndexOutOfBoundsException will be thrown (in accordance with logical expectation).
source
- The source array to copy elements frombegin
- Element to begin copying from (0 = first element)length
- Number of elements to copy from the source arraypublic static byte[] copy(byte[] src, int begin, int length, int size)
Note: If the size of the source array is smaller than the specified length, then a runtime java.lang.ArrayIndexOutOfBoundsException will be thrown (in accordance with logical expectation).
source
- The source array to copy elements frombegin
- Element to begin copying from (0 = first element)length
- Number of elements to copy from the source arraysize
- Overrides the "length" parameter if larger than length specifiedpublic static char[] copy(char[] src, int begin, int length)
Note: If the size of the source array is smaller than the specified length, then a runtime java.lang.ArrayIndexOutOfBoundsException will be thrown (in accordance with logical expectation).
source
- The source array to copy elements frombegin
- Element to begin copying from (0 = first element)length
- Number of elements to copy from the source arraypublic static char[] copy(char[] src, int begin, int length, int size)
Note: If the size of the source array is smaller than the specified length, then a runtime java.lang.ArrayIndexOutOfBoundsException will be thrown (in accordance with logical expectation).
source
- The source array to copy elements frombegin
- Element to begin copying from (0 = first element)length
- Number of elements to copy from the source arraysize
- Overrides the "length" parameter if larger than length specifiedpublic static double[] copy(double[] src, int begin, int length)
Note: If the size of the source array is smaller than the specified length, then a runtime java.lang.ArrayIndexOutOfBoundsException will be thrown (in accordance with logical expectation).
source
- The source array to copy elements frombegin
- Element to begin copying from (0 = first element)length
- Number of elements to copy from the source arraypublic static double[] copy(double[] src, int begin, int length, int size)
Note: If the size of the source array is smaller than the specified length, then a runtime java.lang.ArrayIndexOutOfBoundsException will be thrown (in accordance with logical expectation).
source
- The source array to copy elements frombegin
- Element to begin copying from (0 = first element)length
- Number of elements to copy from the source arraysize
- Overrides the "length" parameter if larger than length specifiedpublic static float[] copy(float[] src, int begin, int length)
Note: If the size of the source array is smaller than the specified length, then a runtime java.lang.ArrayIndexOutOfBoundsException will be thrown (in accordance with logical expectation).
source
- The source array to copy elements frombegin
- Element to begin copying from (0 = first element)length
- Number of elements to copy from the source arraypublic static float[] copy(float[] src, int begin, int length, int size)
Note: If the size of the source array is smaller than the specified length, then a runtime java.lang.ArrayIndexOutOfBoundsException will be thrown (in accordance with logical expectation).
source
- The source array to copy elements frombegin
- Element to begin copying from (0 = first element)length
- Number of elements to copy from the source arraysize
- Overrides the "length" parameter if larger than length specifiedpublic static int[] copy(int[] src, int begin, int length)
Note: If the size of the source array is smaller than the specified length, then a runtime java.lang.ArrayIndexOutOfBoundsException will be thrown (in accordance with logical expectation).
source
- The source array to copy elements frombegin
- Element to begin copying from (0 = first element)length
- Number of elements to copy from the source arraypublic static int[] copy(int[] src, int begin, int length, int size)
Note: If the size of the source array is smaller than the specified length, then a runtime java.lang.ArrayIndexOutOfBoundsException will be thrown (in accordance with logical expectation).
source
- The source array to copy elements frombegin
- Element to begin copying from (0 = first element)length
- Number of elements to copy from the source arraysize
- Overrides the "length" parameter if larger than length specifiedpublic static long[] copy(long[] src, int begin, int length)
Note: If the size of the source array is smaller than the specified length, then a runtime java.lang.ArrayIndexOutOfBoundsException will be thrown (in accordance with logical expectation).
source
- The source array to copy elements frombegin
- Element to begin copying from (0 = first element)length
- Number of elements to copy from the source arraypublic static long[] copy(long[] src, int begin, int length, int size)
Note: If the size of the source array is smaller than the specified length, then a runtime java.lang.ArrayIndexOutOfBoundsException will be thrown (in accordance with logical expectation).
source
- The source array to copy elements frombegin
- Element to begin copying from (0 = first element)length
- Number of elements to copy from the source arraysize
- Overrides the "length" parameter if larger than length specifiedpublic static short[] copy(short[] src, int begin, int length)
Note: If the size of the source array is smaller than the specified length, then a runtime java.lang.ArrayIndexOutOfBoundsException will be thrown (in accordance with logical expectation).
source
- The source array to copy elements frombegin
- Element to begin copying from (0 = first element)length
- Number of elements to copy from the source arraypublic static short[] copy(short[] src, int begin, int length, int size)
Note: If the size of the source array is smaller than the specified length, then a runtime java.lang.ArrayIndexOutOfBoundsException will be thrown (in accordance with logical expectation).
source
- The source array to copy elements frombegin
- Element to begin copying from (0 = first element)length
- Number of elements to copy from the source arraysize
- Overrides the "length" parameter if larger than length specifiedpublic static <Type> Type[] copy(Type[] src, int begin, int length)
Note: If the size of the source array is smaller than the specified length, then a runtime java.lang.ArrayIndexOutOfBoundsException will be thrown (in accordance with logical expectation).
source
- The source array to copy elements frombegin
- Element to begin copying from (0 = first element)length
- Number of elements to copy from the source arraypublic static <Type> Type[] copy(Type[] src, int begin, int length, int size)
Note: If the size of the source array is smaller than the specified length, then a runtime java.lang.ArrayIndexOutOfBoundsException will be thrown (in accordance with logical expectation).
source
- The source array to copy elements frombegin
- Element to begin copying from (0 = first element)length
- Number of elements to copy from the source arraysize
- Overrides the "length" parameter if larger than length specifiedpublic static <Type> HashMap<Type,Type> createHashMap(Type... pairs)
The following example code demonstrates how a static HashMap, containing a partial list of ISO country codes (the HashMap's "key") and corresponding country names (the HashMap's "value"), is defined (the "static" keyword is only needed because in this example the HashMap is being defined class-wide {outside of constructor and method declarations}):
// -------------------------------------------------------------------------- // Requires: import ca.randolf.util.ArrayTools; // ...and: import java.util.HashMap; // -------------------------------------------------------------------------- static HashMap<String, String> COUNTRY_CODES = ArrayTools.createHashMap( "CA", "Canada", "CN", "China", "DE", "Germany", "UK', "United Kingdom", "US", "United States of America", );
The HashMap object is constructed with an initial capacity that is exactly half of the size of the array to reduce overhead. If you provide duplicate keys (which is pointless because it wastes CPU cycles), then previously defined keys will be replaced.
The java.lang.UnsupportedOperationException exception is thrown if the array contains an odd number of objects.
pairs
- Array that contains an even number of objectspublic static String hex(boolean[] array)
It's important to note that each nybble (hexadecimal character) represents exactly 4 bits, or four boolean states. If you supply a number of booleans that is not a multiple of 4, then up to three "false" booleans will effectively be inserted so that the final boolean represents a value of 1.
For example, the following code...
System.out.println(ArrayTools.hex(true));
System.out.println(ArrayTools.hex(true, true));
System.out.println(ArrayTools.hex(true, true, true));
System.out.println(ArrayTools.hex(true, true, true, true));
System.out.println(ArrayTools.hex(true, true, true, true, true));
System.out.println(ArrayTools.hex(true, true, true, true, true, true));
System.out.println(ArrayTools.hex(true, true, true, true, true, true, true));
System.out.println(ArrayTools.hex(true, true, true, true, true, true, true, true));
...produces this output:
1
3
7
f
1f
3f
7f
ff
array
- The array to convertpublic static String hex(byte[] array)
array
- The array to convertpublic static String hex(char[] array)
array
- The array to convertpublic static String hex(double[] array)
array
- The array to convertpublic static String hex(float[] array)
array
- The array to convertpublic static String hex(int[] array)
array
- The array to convertpublic static String hex(long[] array)
array
- The array to convertpublic static String hex(short[] array)
array
- The array to convertpublic static <Type> String hex(Type[] array)
array
- The array to convertpublic static int index(boolean[] array, boolean element)
array
- The array to searchelement
- The element to search forpublic static int index(byte[] array, byte element)
array
- The array to searchelement
- The element to search forpublic static int index(char[] array, char element)
array
- The array to searchelement
- The element to search forpublic static int index(double[] array, double element)
array
- The array to searchelement
- The element to search forpublic static int index(float[] array, float element)
array
- The array to searchelement
- The element to search forpublic static int index(int[] array, int element)
array
- The array to searchelement
- The element to search forpublic static int index(long[] array, long element)
array
- The array to searchelement
- The element to search forpublic static int index(short[] array, short element)
array
- The array to searchelement
- The element to search forpublic static <Type> int index(Type[] array, Type element)
array
- The array to searchelement
- The element to search forpublic static boolean[] join(boolean[]... array)
array
- The arrays to joinpublic static byte[] join(byte[]... array)
array
- The arrays to joinpublic static char[] join(char[]... array)
array
- The arrays to joinpublic static double[] join(double[]... array)
array
- The arrays to joinpublic static float[] join(float[]... array)
array
- The arrays to joinpublic static int[] join(int[]... array)
array
- The arrays to joinpublic static long[] join(long[]... array)
array
- The arrays to joinpublic static short[] join(short[]... array)
array
- The arrays to joinpublic static <Type> Type[] join(Type[]... array)
Warning: If the size of the target array is 0, then a NULL will be returned instead of a an empty array (this is due to a short-coming in the design of reflection and generics that comes into play when used with variable arguments {a.k.a., varargs}, and results in throwing an exception due to casting a two-dimensional array class to a one-dimensional array class).
array
- The arrays to joinpublic static long length(String... src)
source
- The source array to measurepublic static long length(StringBuilder... src)
source
- The source array to measurepublic static boolean max(boolean[] array)
For the purposes of this method, TRUE is greater than FALSE.
array
- The array to searchArrayIndexOutOfBoundsException
- if an array containing 0
elements was suppliedpublic static byte max(byte[] array)
array
- The array to searchArrayIndexOutOfBoundsException
- if an array containing 0
elements was suppliedpublic static char max(char[] array)
array
- The array to searchArrayIndexOutOfBoundsException
- if an array containing 0
elements was suppliedpublic static double max(double[] array)
array
- The array to searchArrayIndexOutOfBoundsException
- if an array containing 0
elements was suppliedpublic static float max(float[] array)
array
- The array to searchArrayIndexOutOfBoundsException
- if an array containing 0
elements was suppliedpublic static int max(int[] array)
array
- The array to searchArrayIndexOutOfBoundsException
- if an array containing 0
elements was suppliedpublic static long max(long[] array)
array
- The array to searchArrayIndexOutOfBoundsException
- if an array containing 0
elements was suppliedpublic static short max(short[] array)
array
- The array to searchArrayIndexOutOfBoundsException
- if an array containing 0
elements was suppliedpublic static <Type> Type max(Type[] array)
array
- The array to searchArrayIndexOutOfBoundsException
- if an array containing 0
elements was suppliedpublic static boolean min(boolean[] array)
For the purposes of this method, FALSE is less than TRUE.
array
- The array to searchArrayIndexOutOfBoundsException
- if an array containing 0
elements was suppliedpublic static byte min(byte[] array)
array
- The array to searchArrayIndexOutOfBoundsException
- if an array containing 0
elements was suppliedpublic static char min(char[] array)
array
- The array to searchArrayIndexOutOfBoundsException
- if an array containing 0
elements was suppliedpublic static double min(double[] array)
array
- The array to searchArrayIndexOutOfBoundsException
- if an array containing 0
elements was suppliedpublic static float min(float[] array)
array
- The array to searchArrayIndexOutOfBoundsException
- if an array containing 0
elements was suppliedpublic static int min(int[] array)
array
- The array to searchArrayIndexOutOfBoundsException
- if an array containing 0
elements was suppliedpublic static long min(long[] array)
array
- The array to searchArrayIndexOutOfBoundsException
- if an array containing 0
elements was suppliedpublic static <Type> Type min(Type[] array)
array
- The array to searchArrayIndexOutOfBoundsException
- if an array containing 0
elements was suppliedpublic static boolean[] removeNULLs(Boolean[] array)
array
- The array to remove NULL entries frompublic static byte[] removeNULLs(Byte[] array)
array
- The array to remove NULL entries frompublic static char[] removeNULLs(Character[] array)
array
- The array to remove NULL entries frompublic static double[] removeNULLs(Double[] array)
array
- The array to remove NULL entries frompublic static float[] removeNULLs(Float[] array)
array
- The array to remove NULL entries frompublic static int[] removeNULLs(Integer[] array)
array
- The array to remove NULL entries frompublic static long[] removeNULLs(Long[] array)
array
- The array to remove NULL entries frompublic static short[] removeNULLs(Short[] array)
array
- The array to remove NULL entries frompublic static <Type> Type[] removeNULLs(Type[] array)
array
- The array to remove NULL entries frompublic static boolean[] resize(boolean[] array, int n)
array
- The array to re-sizen
- The desired sizepublic static byte[] resize(byte[] array, int n)
array
- The array to re-sizen
- The desired sizepublic static char[] resize(char[] array, int n)
array
- The array to re-sizen
- The desired sizepublic static double[] resize(double[] array, int n)
array
- The array to re-sizen
- The desired sizepublic static float[] resize(float[] array, int n)
array
- The array to re-sizen
- The desired sizepublic static int[] resize(int[] array, int n)
array
- The array to re-sizen
- The desired sizepublic static long[] resize(long[] array, int n)
array
- The array to re-sizen
- The desired sizepublic static short[] resize(short[] array, int n)
array
- The array to re-sizen
- The desired sizepublic static <Type> Type[] resize(Type[] array, int n)
array
- The array to re-sizen
- The desired size