Java Utililty Methods Unsigned Int Create

List of utility methods to do Unsigned Int Create

Description

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

Method

inttoUnsignedInt(byte b)
to Unsigned Int
return (b >= 0) ? b : 256 + b;
inttoUnsignedInt(byte b)
Convert a signed byte to an unsigned int (unsigned in the sense that only values between 0 and 255 are allowed).
return b & 0xFF;
longtoUnsignedInt(byte b1, byte b2, byte b3, byte b4)
to Unsigned Int
return ((b1 & 0xFF) | ((b2 & 0xFF) << 8) | ((b3 & 0xFF) << 16) | ((b4 & 0xFF) << 24)) & 0xFFFFFFFFl;
inttoUnsignedInt(byte value)
Transforms the given byte value to an positive int between 0 and 255.
int intValue = value & 0x7F;
return value < 0 ? intValue + 128 : intValue;
inttoUnsignedInt(byte x)
Converts the argument to an int by an unsigned conversion.
return ((int) x) & 0xff;
int[]toUnsignedInt(byte[] a)
this method copies a byte array to an int array and treats the byte values as unsigned
int[] b = new int[a.length];
for (int i = 0; i < a.length; i++) {
    b[i] = a[i] & 0xff;
return b;
longtoUnsignedInt(char[] bytes, boolean le)
to Unsigned Int
if (bytes.length != 8)
    return 0;
return Long.parseLong(bytesToString(bytes, le, false), 16);
longtoUnsignedInt(int i)
Converts an int to the corresponding unsigned int value and returns the result as a long
return (long) (i & MAX_INT);
inttoUnsignedInt(int value)
to Unsigned Int
return value & 0xFF;
longtoUnsignedInt(int value)
to Unsigned Int
if (value >= 0) {
    return value;
} else {
    return ((long) value) >>> 32;