Package org.apache.sshd.common.util
Class NumberUtils
- java.lang.Object
-
- org.apache.sshd.common.util.NumberUtils
-
public final class NumberUtils extends Object
- Author:
- Apache MINA SSHD Project
-
-
Field Summary
Fields Modifier and Type Field Description static List<Class<?>>NUMERIC_PRIMITIVE_CLASSES
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static List<Integer>asList(int... values)static intdiffOffset(byte[] a1, int startPos1, byte[] a2, int startPos2, int len)static byte[]emptyIfNull(byte[] a)static intgetNextPowerOf2(int value)static inthashCode(byte... values)static inthashCode(byte[] a, int offset, int len)static inthashCode(int... values)static inthashCode(long... values)static booleanisEmpty(byte[] a)static booleanisEmpty(int[] a)static booleanisEmpty(long[] a)static booleanisIntegerNumber(CharSequence cs)Checks if optional sign and all others are '0'-'9'static booleanisNumericClass(Class<?> clazz)static Stringjoin(char separator, boolean unsigned, byte... values)static Stringjoin(char separator, int... values)static Stringjoin(char separator, long... values)static Stringjoin(CharSequence separator, boolean unsigned, byte... values)static Stringjoin(CharSequence separator, int... values)static Stringjoin(CharSequence separator, long... values)static intlength(byte... a)static intlength(int... a)static intlength(long... a)static IntegertoInteger(Number n)
-
-
-
Method Detail
-
getNextPowerOf2
public static int getNextPowerOf2(int value)
- Parameters:
value- The original (non-negative) value- Returns:
- The closest positive power of 2 that is greater or equal to the value. If none can be found then returns the original value
-
hashCode
public static int hashCode(long... values)
-
hashCode
public static int hashCode(int... values)
-
hashCode
public static int hashCode(byte... values)
-
hashCode
public static int hashCode(byte[] a, int offset, int len)
-
diffOffset
public static int diffOffset(byte[] a1, int startPos1, byte[] a2, int startPos2, int len)
-
isNumericClass
public static boolean isNumericClass(Class<?> clazz)
- Parameters:
clazz- TheClassto examine - ignored ifnull- Returns:
- If the class is a
Numberor one of the primitive numerical types - See Also:
NUMERIC_PRIMITIVE_CLASSES
-
join
public static String join(CharSequence separator, long... values)
-
join
public static String join(char separator, long... values)
-
join
public static String join(CharSequence separator, boolean unsigned, byte... values)
-
join
public static String join(char separator, boolean unsigned, byte... values)
-
join
public static String join(CharSequence separator, int... values)
-
join
public static String join(char separator, int... values)
-
emptyIfNull
public static byte[] emptyIfNull(byte[] a)
-
isEmpty
public static boolean isEmpty(byte[] a)
-
isEmpty
public static boolean isEmpty(int[] a)
-
isEmpty
public static boolean isEmpty(long[] a)
-
length
public static int length(byte... a)
-
length
public static int length(int... a)
-
length
public static int length(long... a)
-
isIntegerNumber
public static boolean isIntegerNumber(CharSequence cs)
Checks if optional sign and all others are '0'-'9'- Parameters:
cs- TheCharSequenceto check- Returns:
trueif valid integer number
-
-