Package host.anzo.commons.utils
Class NumberUtilsEx
java.lang.Object
org.apache.commons.lang3.math.NumberUtils
host.anzo.commons.utils.NumberUtilsEx
public class NumberUtilsEx
extends org.apache.commons.lang3.math.NumberUtils
- Since:
- 9/8/2021
-
Field Summary
Fields inherited from class org.apache.commons.lang3.math.NumberUtils
BYTE_MINUS_ONE, BYTE_ONE, BYTE_ZERO, DOUBLE_MINUS_ONE, DOUBLE_ONE, DOUBLE_ZERO, FLOAT_MINUS_ONE, FLOAT_ONE, FLOAT_ZERO, INTEGER_MINUS_ONE, INTEGER_ONE, INTEGER_TWO, INTEGER_ZERO, LONG_INT_MAX_VALUE, LONG_INT_MIN_VALUE, LONG_MINUS_ONE, LONG_ONE, LONG_ZERO, SHORT_MINUS_ONE, SHORT_ONE, SHORT_ZERO -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intcheckedCast(long value) Safe cast long to integer valuestatic longpackIntsToLong(int int1, int int2) Pack to integers to longstatic @NotNull StringtoMetricPrefixedString(Number number) unpackIntsFromLong(long packedValue) Unpack two integers from specified long numberMethods inherited from class org.apache.commons.lang3.math.NumberUtils
compare, compare, compare, compare, createBigDecimal, createBigInteger, createDouble, createFloat, createInteger, createLong, createNumber, isCreatable, isDigits, isNumber, isParsable, max, max, max, max, max, max, max, max, max, max, max, max, min, min, min, min, min, min, min, min, min, min, min, min, toByte, toByte, toDouble, toDouble, toDouble, toDouble, toFloat, toFloat, toInt, toInt, toLong, toLong, toScaledBigDecimal, toScaledBigDecimal, toScaledBigDecimal, toScaledBigDecimal, toScaledBigDecimal, toScaledBigDecimal, toScaledBigDecimal, toScaledBigDecimal, toShort, toShort
-
Constructor Details
-
NumberUtilsEx
public NumberUtilsEx()
-
-
Method Details
-
toMetricPrefixedString
- Parameters:
number- number to convert- Returns:
- number string in metric prefix format.
-
packIntsToLong
public static long packIntsToLong(int int1, int int2) Pack to integers to long- Parameters:
int1- first intint2- second int- Returns:
- long number with two specified packed integers
-
unpackIntsFromLong
public static org.apache.commons.lang3.tuple.Pair<Integer,Integer> unpackIntsFromLong(long packedValue) Unpack two integers from specified long number- Parameters:
packedValue- long number- Returns:
- pair of two unpacked integers
-
checkedCast
public static int checkedCast(long value) Safe cast long to integer value- Parameters:
value- long value- Returns:
- valid integer value
-