List of utility methods to do Unsigned Number Create
int[] | unsignedByteToIntArray(byte[] bytes) unsigned Byte To Int Array int[] ints = new int[bytes.length]; for (int i = 0; i < bytes.length; i++) { ints[i] = unsignedByteToInt(bytes[i]); return ints; |
long | unsignedByteToLong(final byte b) unsigned Byte To Long return (b & 128) + (b & 127);
|
String | unsignedByteToString(int i) unsigned Byte To String return "" + Character.forDigit(i / 16, 16) + Character.forDigit(i % 16, 16); |
short | unsignedByteValue(byte[] data, int offset) unsigned Byte Value return (short) ((int) (data[offset]) & 0xFF); |
int | unsignedByteValue(final byte input) Returns the value of an unsigned byte. final int mask = 0xFF; return input & mask; |
int | unsignedChar(char c) unsigned Char return c & 0xFFFF;
|
int | unsignedChar(int val) unsigned Char return Math.min(Math.max(val, 0), 255); |
int | unsignedCharToInt(byte[] b) unsigned Char To Int if (b.length != 1) { throw new IllegalArgumentException(); int i = 0; i |= b[0] & 0xff; return i; |
int | unsignedCompare(long left, long right) Performs an unsigned long comparison on two unsigned long numbers. final long a = left + Long.MIN_VALUE; final long b = right + Long.MIN_VALUE; if (a < b) { return -1; } else if (a > b) { return 1; return 0; ... |
double | unsignedConstraintValue(double v, double min, double max) Constraint the given value to the upper and lower bound double rv = v; if (min >= 0) { rv = Math.max(rv, min); if (max >= 0) { rv = Math.min(rv, max); return rv; ... |