Class UShort

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

    public final class UShort
    extends UNumber
    implements java.lang.Comparable<UShort>
    The unsigned short type
    Author:
    Lukas Eder, Jens Nerche
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static UShort MAX
      A constant holding the maximum value an unsigned short can have as UShort, 216-1.
      static int MAX_VALUE
      A constant holding the maximum value an unsigned short can have, 216-1.
      static UShort MIN
      A constant holding the minimum value an unsigned short can have as UShort, 0.
      static int MIN_VALUE
      A constant holding the minimum value an unsigned short can have, 0.
    • Field Detail

      • MIN_VALUE

        public static final int MIN_VALUE
        A constant holding the minimum value an unsigned short can have, 0.
        See Also:
        Constant Field Values
      • MAX_VALUE

        public static final int MAX_VALUE
        A constant holding the maximum value an unsigned short can have, 216-1.
        See Also:
        Constant Field Values
      • MIN

        public static final UShort MIN
        A constant holding the minimum value an unsigned short can have as UShort, 0.
      • MAX

        public static final UShort MAX
        A constant holding the maximum value an unsigned short can have as UShort, 216-1.
    • Method Detail

      • valueOf

        public static UShort valueOf​(java.lang.String value)
                              throws java.lang.NumberFormatException
        Create an unsigned short
        Throws:
        java.lang.NumberFormatException - If value does not contain a parsable unsigned short.
      • valueOf

        public static UShort valueOf​(short value)
        Create an unsigned short by masking it with 0xFFFF i.e. (short) -1 becomes (ushort) 65535
      • valueOf

        public static UShort valueOf​(int value)
                              throws java.lang.NumberFormatException
        Create an unsigned short
        Throws:
        java.lang.NumberFormatException - If value is not in the range of an unsigned short
      • intValue

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

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

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

        public double doubleValue()
        Specified by:
        doubleValue in class java.lang.Number
      • toBigInteger

        public java.math.BigInteger toBigInteger()
        Description copied from class: UNumber
        Get this number as a BigInteger. This is a convenience method for calling new BigInteger(toString())
        Overrides:
        toBigInteger in class UNumber
      • hashCode

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

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

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

        public int compareTo​(UShort o)
        Specified by:
        compareTo in interface java.lang.Comparable<UShort>
      • add

        public UShort add​(UShort val)
                   throws java.lang.NumberFormatException
        Throws:
        java.lang.NumberFormatException
      • add

        public UShort add​(int val)
                   throws java.lang.NumberFormatException
        Throws:
        java.lang.NumberFormatException
      • subtract

        public UShort subtract​(int val)