Class UnsignedInteger

    • Field Detail

      • uint32

        protected int uint32
    • Constructor Detail

      • UnsignedInteger

        public UnsignedInteger()
        Initializes this unsigned integer with a value of zero.
      • UnsignedInteger

        public UnsignedInteger​(int value)
        Initializes this unsigned integer with a given value.
        Parameters:
        value - a given initialization value
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • longValue

        public long longValue()
        Returns this value as long integer. The return value will be in the range of [0..232-1]. Note that this is the only method to return this value as an integral value without loss of the magnitude of the original 32 bit unsigned integer.
        Specified by:
        longValue in class Number
        Returns:
        this value as long integer
      • intValue

        public int intValue()
        This method gets the low 31 bits and returns them as integer. That is the value will be in the range of [0..231-1]. Note, that the value to hold is a 32 bit unsigned integer, but the return type is a 32 bit signed integer. So if the highest bit is expected to be set in this value, use the longValue() method instead.
        Specified by:
        intValue in class Number
        Returns:
        this value as integer
      • shortValue

        public short shortValue()
        This method gets the low 15 bits and returns them as short. That is the value will be in the range of [0..215-1].
        Overrides:
        shortValue in class Number
        Returns:
        the low 15 bits as short
      • byteValue

        public byte byteValue()
        This method gets the low 7 bits and returns them as byte. That is the value will be in the range of [0..27-1].
        Overrides:
        byteValue in class Number
        Returns:
        the low 7 bits as byte
      • floatValue

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

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

        public int getByte​(int index)
        Returns the unsigned byte at the given index. That is the return value will be in the range of [0..28-1].
        Parameters:
        index - the byte index, valid values are [0..3], 0 returns the least significant byte
        Returns:
        the unsigned byte at the given index as int
        Throws:
        IllegalArgumentException - if index is invalid
      • getAsByteArray

        public byte[] getAsByteArray()
        Return this 32 bit value as little-endian four byte array.
        Returns:
        this 32 bit value as little-endian four byte array
        Since:
        2.0
      • getUnsignedByteValue

        public int getUnsignedByteValue()
        Gets the lowest unsigned byte and returns it as integer. That is the value will be in the range of [0..28-1].
        Returns:
        the lowest unsigned byte
      • get16BitHigh

        public int get16BitHigh()
        Gets the high 16 bits and returns them as integer. That is the value will be in the range of [0..216-1].
        Returns:
        the high 16 bits as integer
      • get16BitLow

        public int get16BitLow()
        Gets the low 16 bits and returns them as integer. That is the value will be in the range of [0..216-1].
        Returns:
        the low 16 bits as integer
      • getAsBitString

        public String getAsBitString()
        Returns this value in a bit representation. This bits are written from the most to the least significant bit: "76543210 76543210 76543210 76543210":
        Returns:
        this value as a binary string