Java Utililty Methods Integer From

List of utility methods to do Integer From

Description

The list of methods to do Integer From are organized into topic(s).

Method

intintFrombytes(byte[] b, int pos)
int Frombytes
return b2i(b[pos]) + b2i(b[pos + 1]) * 256 + b2i(b[pos + 2]) * 65536 + b2i(b[pos + 3]) * 65536 * 256;
intintFromBytes(byte[] buffer)
int From Bytes
return intFromBytes(buffer, 0, 4);
intintFromBytes(byte[] buffer, int offset)
Converts consecutive bytes from a buffer into an int.
return (int) integralFromBytes(buffer, offset, 4);
intintFromBytes(byte[] bytes)
int From Bytes
int x1 = bytes[0];
int x2 = bytes[1];
int x3 = bytes[2];
int x4 = bytes[3];
if (x1 < 0)
    x1 = x1 + 256;
if (x2 < 0)
    x2 = x2 + 256;
...
intintFromBytes(byte[] bytes)
int From Bytes
return intFromBytes(bytes[0], bytes[1], bytes[2], bytes[3]);
intintFromBytes(byte[] bytes, int offset)
int From Bytes
int ret = 0;
ret |= (bytes[offset + 0] & 0xFF) << 24;
ret |= (bytes[offset + 1] & 0xFF) << 16;
ret |= (bytes[offset + 2] & 0xFF) << 8;
ret |= bytes[offset + 3] & 0xFF;
return ret;
intintFromByteWithoutStupidJavaSignExtension(byte val)
int From Byte Without Stupid Java Sign Extension
int ret = (0x7F) & val;
if (val < 0) {
    ret += 128;
return ret;
intintFromHex(String hex, boolean signed)
Converts a hex representation (hexadecimal two's complement) of an integer to an integer.
if (hex == null || !hex.matches("\\#x[a-fA-F0-9]+")) {
    throw new IllegalArgumentException("hex does not match expected format");
hex = hex.substring(2);
int result = 0;
for (int i = 0; i < hex.length(); i++) {
    result *= 16;
    result += Integer.parseInt(hex.charAt(i) + "", 16);
...
intintFromJSON(String[] json, int pos)
int From JSON
try {
    return Integer.parseInt(json[pos].trim());
} catch (Exception ex) {
    return 0;
intintFromLex(byte[] bytes)
Converts lexicographical sortable int to a regular java int
int v = bytesInt(bytes, 0);
v ^= c32;
return v;