Class Byte
Represents a byte. A byte can only contain integer values between 0 and 255. Large values will be masked.
Syntax
Constructors
Byte()
Default constructor.
Declaration
Byte Byte()
Returns
Type | Description |
---|---|
Byte |
Byte(Integer)
Pass a number to copy into a new object.
Declaration
Byte Byte(Integer value)
Parameters
Type | Name | Description |
---|---|---|
Integer | value | A number 0-255. |
Returns
Type | Description |
---|---|
Byte |
Methods
toBool()
Returns the boolean value of the Byte.
Declaration
Bool toBool()
Returns
Type | Description |
---|---|
Bool |
Examples
If(value != 0)
return true;
else
return false;
toHex()
Convert the value of the current byte to a hexadecimal representation of the byte. For example, 10 will return "a", 11 will return "b", and so on.
Declaration
String toHex()
Returns
Type | Description |
---|---|
String | Hexadecimal representation of the byte. |
Remarks
Use toHex(Integer) to provide the number of padding zeros.
toHex(Integer)
Convert the value of the current byte to a hexadecimal representation of the byte with padding zeros. For example, 10 will return "a", 11 will return "b", and so on.
Declaration
String toHex(Integer padding)
Parameters
Type | Name | Description |
---|---|---|
Integer | padding | The number of padding zeros. |
Returns
Type | Description |
---|---|
String | Hexadecimal representation of the byte with padding zeros. |
toInteger()
Converts a byte value to its integer representation (0 - 255).
Declaration
Integer toInteger()
Returns
Type | Description |
---|---|
Integer | Integer representation (0 - 255) |
toString()
Converts a byte value to its string representation.
Declaration
String toString()
Returns
Type | Description |
---|---|
String |