Class UnsignedLongs


  • public final class UnsignedLongs
    extends 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 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 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​(String string)
        Equivalent to Long.parseUnsignedLong in Java 8.
        Parameters:
        string - the string representation of an unsigned long
        Returns:
        the unsigned long