Class UnsignedLongs


  • public final class UnsignedLongs
    extends java.lang.Object
    Utilities for treating long values as unsigned.

    Similar methods are now available in Java 8, but are required here for Java 6/7 compatibility.

    This class is not part of the public API and may be removed or changed at any time.

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int compare​(long first, long second)
      Equivalent of Long.compareUnsigned in Java 8.
      static long parse​(java.lang.String string)
      Equivalent to Long.parseUnsignedLong in Java 8.
      static java.lang.String toString​(long value)
      Equivalent to Long.toUnsignedString in Java 8.
      • Methods inherited from class java.lang.Object

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

      • compare

        public static int compare​(long first,
                                  long second)
        Equivalent of Long.compareUnsigned in Java 8.
        Parameters:
        first - the first value
        second - the second value
        Returns:
        0 if the values are equal, a value greater than zero if first is greater than second, a value less than zero if first is less than second
      • toString

        public static java.lang.String toString​(long value)
        Equivalent to Long.toUnsignedString in Java 8.
        Parameters:
        value - the long value to treat as unsigned
        Returns:
        the string representation of unsignedLong treated as an unsigned value
      • parse

        public static long parse​(java.lang.String string)
        Equivalent to Long.parseUnsignedLong in Java 8.
        Parameters:
        string - the string representation of an unsigned long
        Returns:
        the unsigned long