List of utility methods to do Unsigned Int Create
long | toUnsignedInt(long value) to Unsigned Int return value &= UNSIGNED_INT_MAX;
|
int | toUnsignedInt(String string) to Unsigned Int int integer = -1; try { integer = Integer.valueOf(string); } catch (NullPointerException | NumberFormatException ignored) { return integer; |
int | toUnsignedInt16(byte[] bytes) to Unsigned Int return ((bytes[2] & 0xff) << 8) | (bytes[3] & 0xff);
|
int | toUnsignedInt32LittleEndian(byte[] bytes) to Unsigned Int Little Endian return ((bytes[3] & 0xff) << 24) | ((bytes[2] & 0xff) << 16) | ((bytes[1] & 0xff) << 8) | (bytes[0] & 0xff);
|
int[] | toUnsignedIntArray(byte[] val) to Unsigned Int Array int[] result = new int[val.length]; for (int i = 0; i < val.length; i++) result[i] = val[i] & 0xff; return result; |
int | toUnsignedIntBigEndien(byte[] bytes) to Unsigned Int Big Endien int v = 0; for (int i = 0; i < bytes.length; i++) { v = (v << (8 * i)) + (bytes[i] & 0xFF); return v; |