Class UnsignedLong

    • Method Detail

      • fromLongBits

        public static UnsignedLong fromLongBits​(long bits)
        Returns an UnsignedLong corresponding to a given bit representation. The argument is interpreted as an unsigned 64-bit value. Specifically, the sign bit of bits is interpreted as a normal bit, and all other bits are treated as usual.

        If the argument is nonnegative, the returned result will be equal to bits, otherwise, the result will be equal to 2^64 + bits.

        To represent decimal constants less than 2^63, consider valueOf(long) instead.

        Since:
        14.0
      • valueOf

        public static UnsignedLong valueOf​(long value)
        Returns an UnsignedLong representing the same value as the specified long.
        Throws:
        IllegalArgumentException - if value is negative
        Since:
        14.0
      • valueOf

        public static UnsignedLong valueOf​(String string)
        Returns an UnsignedLong holding the value of the specified String, parsed as an unsigned long value.
        Throws:
        NumberFormatException - if the string does not contain a parsable unsigned long value
      • plus

        public UnsignedLong plus​(UnsignedLong val)
        Returns the result of adding this and val. If the result would have more than 64 bits, returns the low 64 bits of the result.
        Since:
        14.0
      • minus

        public UnsignedLong minus​(UnsignedLong val)
        Returns the result of subtracting this and val. If the result would have more than 64 bits, returns the low 64 bits of the result.
        Since:
        14.0
      • times

        @CheckReturnValue
        public UnsignedLong times​(UnsignedLong val)
        Returns the result of multiplying this and val. If the result would have more than 64 bits, returns the low 64 bits of the result.
        Since:
        14.0
      • intValue

        public int intValue()
        Returns the value of this UnsignedLong as an int.
        Specified by:
        intValue in class Number
      • longValue

        public long longValue()
        Returns the value of this UnsignedLong as a long. This is an inverse operation to fromLongBits(long).

        Note that if this UnsignedLong holds a value >= 2^63, the returned value will be equal to this - 2^64.

        Specified by:
        longValue in class Number
      • floatValue

        public float floatValue()
        Returns the value of this UnsignedLong as a float, analogous to a widening primitive conversion from long to float, and correctly rounded.
        Specified by:
        floatValue in class Number
      • doubleValue

        public double doubleValue()
        Returns the value of this UnsignedLong as a double, analogous to a widening primitive conversion from long to double, and correctly rounded.
        Specified by:
        doubleValue in class Number
      • bigIntegerValue

        public BigInteger bigIntegerValue()
        Returns the value of this UnsignedLong as a BigInteger.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • toString

        public String toString()
        Returns a string representation of the UnsignedLong value, in base 10.
        Overrides:
        toString in class Object
      • toString

        public String toString​(int radix)
        Returns a string representation of the UnsignedLong value, in base radix. If radix < Character.MIN_RADIX or radix > Character.MAX_RADIX, the radix 10 is used.