Class UInt64

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<UInt64>

    public class UInt64
    extends java.lang.Number
    implements java.lang.Comparable<UInt64>
    Class to represent unsigned 64-bit numbers. Warning: Any functions which take or return a long are restricted to the range of a signed 64bit number. Use the BigInteger methods if you wish access to the full range.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.math.BigInteger MAX_BIG_VALUE
      Maximum allowed value (when accessed as a BigInteger)
      static long MAX_LONG_VALUE
      Maximum allowed value (when accessed as a long)
      static long MIN_VALUE
      Minimum allowed value
    • Constructor Summary

      Constructors 
      Constructor Description
      UInt64​(long value)
      Create a UInt64 from a long.
      UInt64​(long top, long bottom)
      Create a UInt64 from two longs.
      UInt64​(java.lang.String value)
      Create a UInt64 from a String.
      UInt64​(java.math.BigInteger value)
      Create a UInt64 from a BigInteger
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long bottom()
      Least significant 4 bytes.
      byte byteValue()
      The value of this as a byte.
      int compareTo​(UInt64 other)
      Compare two UInt32s.
      double doubleValue()
      The value of this as a double.
      boolean equals​(java.lang.Object o)
      Test two UInt64s for equality.
      float floatValue()
      The value of this as a float.
      int hashCode()  
      int intValue()
      The value of this as a int.
      long longValue()
      The value of this as a long.
      short shortValue()
      The value of this as a short.
      long top()
      Most significant 4 bytes.
      java.lang.String toString()
      The value of this as a string.
      java.math.BigInteger value()
      The value of this as a BigInteger.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • MAX_LONG_VALUE

        public static final long MAX_LONG_VALUE
        Maximum allowed value (when accessed as a long)
        See Also:
        Constant Field Values
      • MAX_BIG_VALUE

        public static final java.math.BigInteger MAX_BIG_VALUE
        Maximum allowed value (when accessed as a BigInteger)
    • Constructor Detail

      • UInt64

        public UInt64​(long value)
        Create a UInt64 from a long.
        Parameters:
        value - Must be a valid integer within MIN_VALUE–MAX_VALUE
        Throws:
        java.lang.NumberFormatException - if value is not between MIN_VALUE and MAX_VALUE
      • UInt64

        public UInt64​(long top,
                      long bottom)
        Create a UInt64 from two longs.
        Parameters:
        top - Most significant 4 bytes.
        bottom - Least significant 4 bytes.
      • UInt64

        public UInt64​(java.math.BigInteger value)
        Create a UInt64 from a BigInteger
        Parameters:
        value - Must be a valid BigInteger between MIN_VALUE–MAX_BIG_VALUE
        Throws:
        java.lang.NumberFormatException - if value is not an integer between MIN_VALUE and MAX_BIG_VALUE
      • UInt64

        public UInt64​(java.lang.String value)
        Create a UInt64 from a String.
        Parameters:
        value - Must parse to a valid integer within MIN_VALUE–MAX_BIG_VALUE
        Throws:
        java.lang.NumberFormatException - if value is not an integer between MIN_VALUE and MAX_BIG_VALUE
    • Method Detail

      • value

        public java.math.BigInteger value()
        The value of this as a BigInteger.
      • byteValue

        public byte byteValue()
        The value of this as a byte.
        Overrides:
        byteValue in class java.lang.Number
      • doubleValue

        public double doubleValue()
        The value of this as a double.
        Specified by:
        doubleValue in class java.lang.Number
      • floatValue

        public float floatValue()
        The value of this as a float.
        Specified by:
        floatValue in class java.lang.Number
      • intValue

        public int intValue()
        The value of this as a int.
        Specified by:
        intValue in class java.lang.Number
      • longValue

        public long longValue()
        The value of this as a long.
        Specified by:
        longValue in class java.lang.Number
      • shortValue

        public short shortValue()
        The value of this as a short.
        Overrides:
        shortValue in class java.lang.Number
      • equals

        public boolean equals​(java.lang.Object o)
        Test two UInt64s for equality.
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • compareTo

        public int compareTo​(UInt64 other)
        Compare two UInt32s.
        Specified by:
        compareTo in interface java.lang.Comparable<UInt64>
        Returns:
        0 if equal, -ve or +ve if they are different.
      • toString

        public java.lang.String toString()
        The value of this as a string.
        Overrides:
        toString in class java.lang.Object
      • top

        public long top()
        Most significant 4 bytes.
      • bottom

        public long bottom()
        Least significant 4 bytes.