Class Uint16

    • Field Detail

      • ZERO

        public static final Uint16 ZERO
        Value of 0.
      • ONE

        public static final Uint16 ONE
        Value of 1.
      • TWO

        public static final Uint16 TWO
        Value of 2.
      • TEN

        public static final Uint16 TEN
        Value of 10.
      • MAX_VALUE

        public static final Uint16 MAX_VALUE
        Value of 65535.
    • Constructor Detail

      • Uint16

        protected Uint16​(Uint16 other)
    • Method Detail

      • fromShortBits

        public static Uint16 fromShortBits​(short bits)
        Returns an Uint16 corresponding to a given bit representation. The argument is interpreted as an unsigned 16-bit value.
        Parameters:
        bits - unsigned bit representation
        Returns:
        A Uint16 instance
      • valueOf

        public static Uint16 valueOf​(byte byteVal)
        Returns an Uint16 corresponding to a given byteVal. The inverse operation is Number.byteValue().
        Parameters:
        byteVal - byte value
        Returns:
        A Uint16 instance
        Throws:
        IllegalArgumentException - if byteVal is less than zero
      • valueOf

        public static Uint16 valueOf​(short shortVal)
        Returns an Uint16 corresponding to a given shortVal. The inverse operation is shortValue().
        Parameters:
        shortVal - short value
        Returns:
        A Uint16 instance
        Throws:
        IllegalArgumentException - if shortVal is less than zero.
      • valueOf

        public static Uint16 valueOf​(int intVal)
        Returns an Uint16 corresponding to a given intVal. The inverse operation is intValue().
        Parameters:
        intVal - int value
        Returns:
        A Uint16 instance
        Throws:
        IllegalArgumentException - if intVal is less than zero or greater than 65535.
      • valueOf

        public static Uint16 valueOf​(long longVal)
        Returns an Uint16 corresponding to a given longVal. The inverse operation is longValue().
        Parameters:
        longVal - long value
        Returns:
        A Uint16 instance
        Throws:
        IllegalArgumentException - if intVal is less than zero or greater than 65535.
      • valueOf

        public static Uint16 valueOf​(Uint8 uint)
        Returns an Uint16 corresponding to a given uint.
        Parameters:
        uint - Uint8 value
        Returns:
        A Uint16 instance
        Throws:
        NullPointerException - if uint is null
      • valueOf

        public static Uint16 valueOf​(String string)
        Returns an Uint16 holding the value of the specified String, parsed as an unsigned int value.
        Parameters:
        string - String to parse
        Returns:
        A Uint16 instance
        Throws:
        NullPointerException - if string is null
        IllegalArgumentException - if the parsed value is less than zero or greater than 65535
        NumberFormatException - if the string does not contain a parsable unsigned int value.
      • valueOf

        public static Uint16 valueOf​(String string,
                                     int radix)
        Returns an Uint16 holding the value of the specified String, parsed as an unsigned int value.
        Parameters:
        string - String to parse
        radix - Radix to use
        Returns:
        A Uint16 instance
        Throws:
        NullPointerException - if string is null
        IllegalArgumentException - if the parsed value is less than zero or greater than 65535
        NumberFormatException - if the string does not contain a parsable unsigned int value, or if the radix is outside of allowed range.
      • intValue

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

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

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

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

        public final Uint16 intern()
        Return an interned (shared) instance equivalent to this object. This may return the same object.
        Returns:
        A shared instance.
      • toJava

        public final int toJava()
        Convert this value to an int.
        Returns:
        An int
      • toUint8

        public final Uint8 toUint8()
        Convert this value to a Uint8.
        Returns:
        A Uint8
        Throws:
        IllegalArgumentException - if this value is greater than 255.
      • toUint32

        public final Uint32 toUint32()
        Convert this value to a Uint32.
        Returns:
        A Uint32
      • toUint64

        public final Uint64 toUint64()
        Convert this value to a Uint64.
        Returns:
        A Uint64
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class Object
      • equals

        public final boolean equals​(@Nullable Object obj)
        Overrides:
        equals in class Object
      • equals

        public final boolean equals​(@Nullable Uint16 obj)
        A slightly faster version of equals(Object).
        Parameters:
        obj - Uint16 object
        Returns:
        true if this object is the same as the obj argument; false otherwise.