Class PrimitiveConverter
Object
PrimitiveConverter
Type conversion between primitive data types.
This class is intended to help with conversion of elements retrieved from Buffer
and
its child-types.
- Author:
- Owen Feehan
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
unsignedByteToInt
(byte value) Converts an unsigned-byte value to a signed int.static int
unsignedByteToShort
(byte value) Converts an unsigned-byte value to a signed short.static int
unsignedIntToInt
(int value) Converts an unsigned-int value to a signed int.static long
unsignedIntToLong
(int value) Converts an unsigned-int value to a signed long.static int
unsignedIntToShort
(int value) Converts an unsigned-int value to a signed int.static int
unsignedShortToInt
(short value) Converts an unsigned-short value to a signed int.
-
Method Details
-
unsignedByteToInt
public static int unsignedByteToInt(byte value) Converts an unsigned-byte value to a signed int.- Parameters:
value
- the value to convert.- Returns:
- the converted value.
-
unsignedShortToInt
public static int unsignedShortToInt(short value) Converts an unsigned-short value to a signed int.- Parameters:
value
- the value to convert.- Returns:
- the converted value.
-
unsignedIntToShort
public static int unsignedIntToShort(int value) Converts an unsigned-int value to a signed int.- Parameters:
value
- the value to convert.- Returns:
- the converted value.
-
unsignedByteToShort
public static int unsignedByteToShort(byte value) Converts an unsigned-byte value to a signed short.- Parameters:
value
- the value to convert.- Returns:
- the converted value.
-
unsignedIntToLong
public static long unsignedIntToLong(int value) Converts an unsigned-int value to a signed long.- Parameters:
value
- the value to convert.- Returns:
- the converted value.
-
unsignedIntToInt
public static int unsignedIntToInt(int value) Converts an unsigned-int value to a signed int.- Parameters:
value
- the value to convert.- Returns:
- the converted value.
-