Class UnsignedLong

All Implemented Interfaces:
Serializable

public final class UnsignedLong extends UnsignedNumber
The UnsignedLong class wraps a value of an unsigned 64 bits number.
Author:
Matteo Merli (matteo.merli@gmail.com)
See Also:
  • Constructor Details

    • UnsignedLong

      public UnsignedLong(byte c)

      Constructor for UnsignedLong.

      Parameters:
      c - a byte
    • UnsignedLong

      public UnsignedLong(short c)

      Constructor for UnsignedLong.

      Parameters:
      c - a short
    • UnsignedLong

      public UnsignedLong(int c)

      Constructor for UnsignedLong.

      Parameters:
      c - a int
    • UnsignedLong

      public UnsignedLong(long c)

      Constructor for UnsignedLong.

      Parameters:
      c - a long
    • UnsignedLong

      public UnsignedLong(Random random)
      Construct a new random UnsignedLong.
      Parameters:
      random - a Random handler
  • Method Details

    • fromBytes

      public static UnsignedLong fromBytes(byte[] c)

      fromBytes.

      Parameters:
      c - an array of
      invalid reference
      byte
      objects
      Returns:
      a UnsignedLong object
    • fromBytes

      public static UnsignedLong fromBytes(byte[] c, int offset)

      fromBytes.

      Parameters:
      c - an array of
      invalid reference
      byte
      objects
      offset - a int
      Returns:
      a UnsignedLong object
    • fromString

      public static UnsignedLong fromString(String c)

      fromString.

      Parameters:
      c - a String object
      Returns:
      a UnsignedLong object
    • fromString

      public static UnsignedLong fromString(String c, int radix)

      fromString.

      Parameters:
      c - a String object
      radix - a int
      Returns:
      a UnsignedLong object
    • getBytes

      public byte[] getBytes()
      Get a byte array representation of the number. The order will be MSB first (Big Endian).
      Specified by:
      getBytes in class UnsignedNumber
      Returns:
      the serialized number
    • toString

      public String toString()
      Specified by:
      toString in class UnsignedNumber
    • intValue

      public int intValue()
      Specified by:
      intValue in class Number
    • longValue

      public long longValue()
      Specified by:
      longValue in class Number
    • floatValue

      public float floatValue()
      Specified by:
      floatValue in class Number
    • doubleValue

      public double doubleValue()
      Specified by:
      doubleValue in class Number
    • compareTo

      public int compareTo(UnsignedNumber other)

      compareTo.

      Specified by:
      compareTo in class UnsignedNumber
      Parameters:
      other - a UnsignedNumber object
      Returns:
      a int
    • equals

      public boolean equals(Object other)
      Specified by:
      equals in class UnsignedNumber
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in class UnsignedNumber
    • shiftRight

      public void shiftRight(int nBits)
      Perform a bit right shift of the value.
      Specified by:
      shiftRight in class UnsignedNumber
      Parameters:
      nBits - the number of positions to shift
    • shiftLeft

      public void shiftLeft(int nBits)
      Perform a bit left shift of the value.
      Specified by:
      shiftLeft in class UnsignedNumber
      Parameters:
      nBits - the number of positions to shift