public final class NumberUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.util.List<java.lang.Class<?>> |
NUMERIC_PRIMITIVE_CLASSES
A
List of all the Class types used to represent the primitive numerical values |
Modifier | Constructor and Description |
---|---|
private |
NumberUtils() |
Modifier and Type | Method and Description |
---|---|
static java.util.List<java.lang.Integer> |
asList(int... values) |
static int |
diffOffset(byte[] a1,
int startPos1,
byte[] a2,
int startPos2,
int len) |
static byte[] |
emptyIfNull(byte[] a) |
static int |
getNextPowerOf2(int value) |
static int |
hashCode(byte... values) |
static int |
hashCode(byte[] a,
int offset,
int len) |
static int |
hashCode(int... values) |
static int |
hashCode(long... values) |
static boolean |
isEmpty(byte[] a) |
static boolean |
isEmpty(int[] a) |
static boolean |
isEmpty(long[] a) |
static boolean |
isIntegerNumber(java.lang.CharSequence cs)
Checks if optional sign and all others are '0'-'9'
|
static boolean |
isNumericClass(java.lang.Class<?> clazz) |
static java.lang.String |
join(char separator,
boolean unsigned,
byte... values) |
static java.lang.String |
join(char separator,
int... values) |
static java.lang.String |
join(char separator,
long... values) |
static java.lang.String |
join(java.lang.CharSequence separator,
boolean unsigned,
byte... values) |
static java.lang.String |
join(java.lang.CharSequence separator,
int... values) |
static java.lang.String |
join(java.lang.CharSequence separator,
long... values) |
static int |
length(byte... a) |
static int |
length(int... a) |
static int |
length(long... a) |
static java.lang.Integer |
toInteger(java.lang.Number n)
Converts a
Number into an Integer if not already such |
public static final java.util.List<java.lang.Class<?>> NUMERIC_PRIMITIVE_CLASSES
List
of all the Class
types used to represent the primitive numerical valuespublic static int getNextPowerOf2(int value)
value
- The original (non-negative) valuepublic static int hashCode(long... values)
public static int hashCode(int... values)
public static int hashCode(byte... values)
public static int hashCode(byte[] a, int offset, int len)
public static int diffOffset(byte[] a1, int startPos1, byte[] a2, int startPos2, int len)
public static boolean isNumericClass(java.lang.Class<?> clazz)
clazz
- The Class
to examine - ignored if null
Number
or one of the primitive numerical typesNUMERIC_PRIMITIVE_CLASSES
public static java.lang.Integer toInteger(java.lang.Number n)
Number
into an Integer
if not already suchn
- The Number
- ignored if null
Integer
valuepublic static java.lang.String join(java.lang.CharSequence separator, long... values)
public static java.lang.String join(char separator, long... values)
public static java.lang.String join(java.lang.CharSequence separator, boolean unsigned, byte... values)
public static java.lang.String join(char separator, boolean unsigned, byte... values)
public static java.lang.String join(java.lang.CharSequence separator, int... values)
public static java.lang.String join(char separator, int... values)
public static byte[] emptyIfNull(byte[] a)
public static boolean isEmpty(byte[] a)
public static boolean isEmpty(int[] a)
public static boolean isEmpty(long[] a)
public static int length(byte... a)
public static int length(int... a)
public static int length(long... a)
public static java.util.List<java.lang.Integer> asList(int... values)
public static boolean isIntegerNumber(java.lang.CharSequence cs)
cs
- The CharSequence
to checktrue
if valid integer number