Class Int96

  • All Implemented Interfaces:
    java.lang.Comparable<Int96>

    public class Int96
    extends java.lang.Object
    implements java.lang.Comparable<Int96>
    This class represents a 96 bit number with 32 bit msb encoded as integer and 64 bit lsb encoded as long. It is unsigned and only allows for non negative values. It also implements comparable interface and comparison involves first compariging msbs and if msbs are equal then we compare lsbs.
    • Field Detail

      • ZERO

        public static final Int96 ZERO
    • Constructor Detail

      • Int96

        public Int96​(int msb,
                     long lsb)
    • Method Detail

      • compareTo

        public int compareTo​(Int96 other)
        Specified by:
        compareTo in interface java.lang.Comparable<Int96>
      • toBytes

        public byte[] toBytes()
      • fromBytes

        public static Int96 fromBytes​(byte[] b)
      • add

        public Int96 add​(int increment)
      • getMsb

        public int getMsb()
      • getLsb

        public long getLsb()
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • canEqual

        protected boolean canEqual​(java.lang.Object other)
      • hashCode

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

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object