tuweni / org.apache.tuweni.bytes / Bytes / ofUnsignedShort

ofUnsignedShort

open static fun ofUnsignedShort(value: Int): Bytes (source)

Return a 2-byte value corresponding to the provided value interpreted as an unsigned short.

Parameters

value - The value, which must be no larger than an unsigned short.

Exceptions

IllegalArgumentException - if value < 0 or value is too big to fit an unsigned 2-byte short (that is, if value >= (1 << 16)).

Return
A 2 bytes value corresponding to value.

open static fun ofUnsignedShort(value: Int, order: ByteOrder): Bytes (source)

Return a 2-byte value corresponding to the provided value interpreted as an unsigned short.

Parameters

value - The value, which must be no larger than an unsigned short.

order - The byte-order for the integer encoding.

Exceptions

IllegalArgumentException - if value < 0 or value is too big to fit an unsigned 2-byte short (that is, if value >= (1 << 16)).

Return
A 2 bytes value corresponding to value.