Java Utililty Methods Integer Convert To

List of utility methods to do Integer Convert To

Description

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

Method

byte[]fromInt(int input)
Returns a byte array containing 4 network byte-ordered bytes representing the given int .
byte[] output = new byte[4];
output[0] = (byte) (input >> 24);
output[1] = (byte) (input >> 16);
output[2] = (byte) (input >> 8);
output[3] = (byte) input;
return output;
byte[]fromInt(int input)
Returns a byte array containing 4 big-endian ordered bytes representing the given integer.
byte[] output = new byte[4];
writeInt(input, output, 0);
return output;
byte[]fromInt(int intValue)
Interpret an int as its binary form
byte[] bytes = new byte[4];
bytes[0] = (byte) (intValue >> 24);
bytes[1] = (byte) ((intValue << 8) >> 24);
bytes[2] = (byte) ((intValue << 16) >> 24);
bytes[3] = (byte) ((intValue << 24) >> 24);
return bytes;
byte[]fromInt(int key)
from Int
byte[] converted = new byte[4];
converted[0] = (byte) ((key >>> 24) & 0xFF);
converted[1] = (byte) ((key >>> 16) & 0xFF);
converted[2] = (byte) ((key >>> 8) & 0xFF);
converted[3] = (byte) (key & 0xFF);
return converted;
StringfromInt(int value)
from Int
return String.valueOf(value);
byte[]fromInt(int value)
from Int
return fromLong(value, 4);
byte[]fromInt(int value)
Converts an integer value to a byte array.
byte[] result = { (byte) (0xFF & (value >>> 24)), (byte) (0xFF & (value >>> 16)),
        (byte) (0xFF & (value >>> 8)), (byte) (0xFF & value) };
return result;
voidfromInt(int value, byte[] arr, int offset)
from Int
value ^= 1 << 31;
arr[offset] = (byte) (value >>> 24);
arr[offset + 1] = (byte) (value >>> 16);
arr[offset + 2] = (byte) (value >>> 8);
arr[offset + 3] = (byte) value;
boolean[]fromInt(int x, int size)
from Int
boolean[] res = new boolean[size];
for (int i = 0; i < size; i++) {
    res[i] = (x & (1 << size - i - 1)) != 0;
return res;
EfromInteger(int idx, Class clazz)
from Integer
if (idx == UNINITIALIZED)
    return null;
E[] vals = clazz.getEnumConstants();
return vals[idx];