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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    checkedCast(long value)
    Safe cast long to integer value
    static long
    packIntsToLong(int int1, int int2)
    Pack to integers to long
    static @NotNull String
     
    static org.apache.commons.lang3.tuple.Pair<Integer,Integer>
    unpackIntsFromLong(long packedValue)
    Unpack two integers from specified long number

    Methods 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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • NumberUtilsEx

      public NumberUtilsEx()
  • Method Details

    • toMetricPrefixedString

      @NotNull public static @NotNull String toMetricPrefixedString(Number number)
      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 int
      int2 - 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