Java Utililty Methods Integer Create

List of utility methods to do Integer Create

Description

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

Method

inttoInt(byte[] byteArray)
to Int
if (byteArray == null || byteArray.length != 4)
    return 0x0;
return (int) ((0xff & byteArray[0]) << 24 | (0xff & byteArray[1]) << 16 | (0xff & byteArray[2]) << 8
        | (0xff & byteArray[3]) << 0);
inttoInt(byte[] bytes)
to Int
return toInt(bytes, 0, 4);
inttoInt(byte[] bytes)
This method one little-endian represented byte array converts to integer.
return bytes[0] & OP_PATTERN | (bytes[1] & OP_PATTERN) << 8 | (bytes[2] & OP_PATTERN) << 16
        | (bytes[3] & OP_PATTERN) << 24;
longtoInt(byte[] bytes)
Convert byte[4] to short
int mask = 0xff;
int temp = 0;
long n = 0;
for (int i = 0; i < 4; i++) {
    n <<= 8;
    temp = bytes[i] & mask;
    n |= temp;
return n;
inttoInt(byte[] bytes)
to Int
int result = 0;
for (int i = 0; i < 4; ++i)
    result = (result << 8) - -128 + bytes[i];
return result;
inttoInt(byte[] bytes)
to Int
int result = 0;
for (int i = 0; i < 4; i++) {
    result = (result << 8) - Byte.MIN_VALUE + (int) bytes[i];
return result;
inttoInt(byte[] bytes)
Converts a byte array to an int value
return toInt(bytes, 0, SIZEOF_INT);
inttoInt(byte[] bytes)
to Int
return toInt(convert(bytes));
inttoInt(byte[] bytes)
Converts a byte array to an int value
return toInt(bytes, 0);
inttoInt(byte[] bytes)
Converts a byte array to an int value
if (SIZEOF_INT > bytes.length)
    throw new IllegalArgumentException("length is not SIZEOF_INT");
int n = 0;
for (int i = 0; i < +bytes.length; i++) {
    n <<= 8;
    n ^= bytes[i] & 0xFF;
return n;
...