public class ArrayUtils extends Object
Modifier and Type | Field and Description |
---|---|
protected static double |
GOLDEN_RATIO
the Golden ration (φ).
|
Constructor and Description |
---|
ArrayUtils() |
Modifier and Type | Method and Description |
---|---|
static int[] |
cast(double[] arr)
cast double[] to int[]
|
static double[] |
cast(float[] arr)
cast float[] to double[]
|
static double[] |
cast(int[] arr)
cast int[] to double[]
|
static byte[] |
ensureCapacity(byte[] array,
int length)
Grow an array to ensure it is the desired length.
|
static byte[] |
ensureCapacity(byte[] array,
int length,
int preserve)
Grow an array to ensure it is the desired length.
|
static byte[] |
grow(byte[] array,
int length)
Grow an array to ensure it is at least the desired length.
|
static byte[] |
grow(byte[] array,
int length,
int preserve)
Grow an array to ensure it is at least the desired length.
|
static double[] |
grow(double[] array,
int length)
grow array
|
static int[] |
grow(int[] array,
int length)
grow array
|
static short[] |
grow(short[] array,
int length)
grow array
|
static byte[] |
growOrCreate(byte[] arr,
int len) |
static int[] |
growOrCreate(int[] arr,
int len) |
static int[] |
intersection(int[] arr1,
int[] arr2)
return intersection between two int[]
|
static int[][] |
invert(int[][] input) |
static String |
join(boolean[] in,
String join)
Join some strings together.
|
static String |
join(byte[] in,
String join)
join string
|
static String |
join(double[] in,
String join)
join string
|
static String |
join(int[] in,
String join)
Join some strings together.
|
static String |
join(String[] in,
char join)
Join some strings together.
|
static String |
join(String[] in,
String join)
Join some strings together.
|
static String |
join(String[] in,
String join,
int l,
int r)
Join some strings together.
|
static int[] |
parseCommaDelimitedInts(String src)
parse comma delimited int
|
static String[] |
parseCommaDelimitedString(String src)
parse comma delimited string
|
static int[] |
parseDelimitedInts(String src,
String sep)
parse comma delimited int
|
static String[] |
parseDelimitedString(String src,
String delim)
parse delimited string
|
static String[] |
parseDelimitedString(String src,
String[] delims)
parse delimited string
|
static void |
reverse(double[] a)
Reverse the order of an array of doubles
|
static void |
reverse(int[] a)
Reverse the order of an array of ints
|
static int[] |
union(int[] arr1,
int[] arr2)
union 2 int[]
|
protected static final double GOLDEN_RATIO
public static int[][] invert(int[][] input)
public static byte[] ensureCapacity(byte[] array, int length)
array
- input arraylength
- ensure array is this lengthpublic static byte[] ensureCapacity(byte[] array, int length, int preserve)
array
- input arraylength
- new desired lengthpreserve
- amount of old array to copy to new array in case of reallocationpublic static byte[] grow(byte[] array, int length)
array
- input arraylength
- minimuim length of new arraypublic static int[] growOrCreate(int[] arr, int len)
public static byte[] growOrCreate(byte[] arr, int len)
public static void reverse(double[] a)
public static void reverse(int[] a)
public static byte[] grow(byte[] array, int length, int preserve)
array
- input arraylength
- minimuim length of new arraypublic static String join(String[] in, String join)
in
- Strings to joinjoin
- Character or String to join bypublic static String join(String[] in, String join, int l, int r)
in
- join
- l
- r
- public static String join(String[] in, char join)
in
- Strings to joinjoin
- Character or String to join bypublic static String join(int[] in, String join)
in
- join
- public static String join(boolean[] in, String join)
in
- join
- public static int[] grow(int[] array, int length)
array
- length
- public static double[] grow(double[] array, int length)
array
- length
- public static short[] grow(short[] array, int length)
array
- length
- public static String[] parseCommaDelimitedString(String src)
src
- public static String[] parseDelimitedString(String src, String delim)
src
- delim
- public static String[] parseDelimitedString(String src, String[] delims)
src
- delims
- public static int[] parseCommaDelimitedInts(String src)
src
- public static int[] parseDelimitedInts(String src, String sep)
src
- sep
- public static String join(byte[] in, String join)
in
- join
- public static String join(double[] in, String join)
in
- join
- public static int[] cast(double[] arr)
arr
- public static double[] cast(int[] arr)
arr
- public static double[] cast(float[] arr)
arr
- public static int[] intersection(int[] arr1, int[] arr2)
arr1
- arr2
- public static int[] union(int[] arr1, int[] arr2)
arr1
- arr2
- Terrier 4.0. Copyright © 2004-2014 University of Glasgow