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

longtoUnsignedInt(long value)
to Unsigned Int
return value &= UNSIGNED_INT_MAX;
inttoUnsignedInt(String string)
to Unsigned Int
int integer = -1;
try {
    integer = Integer.valueOf(string);
} catch (NullPointerException | NumberFormatException ignored) { 
return integer;
inttoUnsignedInt16(byte[] bytes)
to Unsigned Int
return ((bytes[2] & 0xff) << 8) | (bytes[3] & 0xff);
inttoUnsignedInt32LittleEndian(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;
inttoUnsignedIntBigEndien(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;