public final class StaticUtils
extends java.lang.Object
| Constructor and Description |
|---|
StaticUtils() |
| Modifier and Type | Method and Description |
|---|---|
static int |
linearSearch(int[] array,
int i)
Perform a linear search for an integer in a given array.
|
static int |
linearSearch(long[] array,
int start,
int end,
long l)
Perform a linear search for a long in a given array.
|
static int |
linearSearch(long[] array,
long l)
Perform a linear search for a long in a given array.
|
static int[] |
ListToArray(java.util.List<java.lang.Integer> list)
Convert a
List of Integers to an array of ints. |
static int[] |
ListToSortedArray(java.util.List<java.lang.Integer> list)
Convert a
List of Integers to a sorted array of ints. |
public static int[] ListToSortedArray(java.util.List<java.lang.Integer> list)
List of Integers to a sorted array of ints.list - The List to convert.null if list is null.public static int[] ListToArray(java.util.List<java.lang.Integer> list)
List of Integers to an array of ints.list - The List to convert.null if list is null.public static int linearSearch(int[] array,
int i)
array - The array to search (the hay stack). Must not be null!i - The value to search for (the needle).-1 if the value has not been found.public static int linearSearch(long[] array,
long l)
array - The array to search (the hay stack). Must not be null!l - The value to search for (the needle).-1 if the value has not been found.public static int linearSearch(long[] array,
int start,
int end,
long l)
array - The array to search (the hay stack). Must not be null!start - the inclusive start position of the range to searchend - the exclusive end position of the range to searchl - The value to search for (the needle).-1 if the value has not been found.