Class NumericHelper


  • @InternalApi
    public final class NumericHelper
    extends java.lang.Object
    Helper for numeric values.
    Since:
    2.2.11
    Author:
    Mark Rotteveel
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean fitsUnsigned32BitInteger​(long longValue)
      Checks if the supplied long would fit in an unsigned 32-bit integer.
      static long toUnsignedLong​(int intValue)
      Returns the int as an unsigned long (no sign extension).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • toUnsignedLong

        public static long toUnsignedLong​(int intValue)
        Returns the int as an unsigned long (no sign extension).
        Parameters:
        intValue - Integer value
        Returns:
        intValue as an unsigned long.
      • fitsUnsigned32BitInteger

        public static boolean fitsUnsigned32BitInteger​(long longValue)
        Checks if the supplied long would fit in an unsigned 32-bit integer.

        In essence this checks if longValue >= 0 && longValue <= 0xffffffffL

        Parameters:
        longValue - Long value to check
        Returns:
        true if the long value fits as an unsigned 32 bit value