Java Utililty Methods Unsigned Number Create

List of utility methods to do Unsigned Number Create

Description

The list of methods to do Unsigned Number Create are organized into topic(s).

Method

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;
longunsignedByteToLong(final byte b)
unsigned Byte To Long
return (b & 128) + (b & 127);
StringunsignedByteToString(int i)
unsigned Byte To String
return "" + Character.forDigit(i / 16, 16) 
        + Character.forDigit(i % 16, 16);
shortunsignedByteValue(byte[] data, int offset)
unsigned Byte Value
return (short) ((int) (data[offset]) & 0xFF);
intunsignedByteValue(final byte input)
Returns the value of an unsigned byte.
final int mask = 0xFF;
return input & mask;
intunsignedChar(char c)
unsigned Char
return c & 0xFFFF;
intunsignedChar(int val)
unsigned Char
return Math.min(Math.max(val, 0), 255);
intunsignedCharToInt(byte[] b)
unsigned Char To Int
if (b.length != 1) {
    throw new IllegalArgumentException();
int i = 0;
i |= b[0] & 0xff;
return i;
intunsignedCompare(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;
...
doubleunsignedConstraintValue(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;
...