public final class IntArrayUtils extends Object
Constructor and Description |
---|
IntArrayUtils() |
Modifier and Type | Method and Description |
---|---|
static int |
binarySearch(int[] array,
int ele,
int start,
int end)
Binary search on a span of a sorted integer array.
|
static boolean[] |
ensure_size(boolean[] array,
int req,
int growth_factor,
int multiplication_limit) |
static char[] |
ensure_size(char[] array,
int req,
int growth_factor,
int multiplication_limit) |
static int[] |
ensure_size(int[] array,
int req) |
static int[] |
ensure_size(int[] array,
int req,
int growth_factor,
int multiplication_limit) |
static int |
find(int x,
int[] a)
Find an int in an (unsorted) array.
|
public static final int[] ensure_size(int[] array, int req)
public static final int[] ensure_size(int[] array, int req, int growth_factor, int multiplication_limit)
public static final boolean[] ensure_size(boolean[] array, int req, int growth_factor, int multiplication_limit)
public static final char[] ensure_size(char[] array, int req, int growth_factor, int multiplication_limit)
public static final int binarySearch(int[] array, int ele, int start, int end)
java.util.Arrays
instead; it's probably faster.array
- The input array.ele
- The int we're looking for.start
- Start looking at this position, where 0 ≤=
start ≤= end ≤= array.length
.end
- Look up to this point (non-inclusive).ele
, if found; -insertPos-1
, if not.
insertPos
is the position where ele
would be inserted.
Note that the return value is >= start
iff ele
was
found; see java.util.Arrays
.public static final int find(int x, int[] a)
x
- The int to find.a
- The array.x
was found; -1
if
not found.Copyright © 2014. All rights reserved.