Java Utililty Methods Integer to

List of utility methods to do Integer to

Description

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

Method

Integer[]intToIntegerArray(int[] array)
int To Integer Array
if (array == null) {
    return null;
} else if (array.length == 0) {
    return new Integer[0];
Integer[] retarray = new Integer[array.length];
int i = 0;
for (int member : array) {
...
byte[]intToLengthHexByte(int args, int hexLength)
int To Length Hex Byte
String s = Integer.toHexString(args);
byte[] re = hexToLengthHexByte(s);
if (s.length() >= hexLength * 2) {
    return re;
} else {
    byte[] newb = new byte[hexLength];
    System.arraycopy(re, 0, newb, hexLength - re.length, re.length);
    return newb;
...
StringintToLetter(int index)
Returns the 0-indexed String index correlating to the given integer index
index += 1;
String str = "";
int r = index % 26;
do {
    str = iIntToLetter(r) + str;
    index /= 26;
    r = index % 26;
} while (r != 0);
...
byte[]intToLex(int v)
Converts a regular java int to a lexicographical sortable long
v ^= c32;
return intBytes(v, new byte[4], 0);
byte[]intToLittleEndian(int val)
Converts a long to a little-endian four-byte array
final byte[] b = new byte[4];
for (int i = 0; i < 4; i++) {
    b[i] = (byte) (val % 256);
    val = val / 256;
return b;
byte[]intToLittleEndian(int value)
Converts an int to the corresponding 4-byte little endian array.
return integerToLittleEndian(new byte[4], 0, value, 4);
int[]intToMCInts(int i)
Spilts a Java int into a so-called Minecraft int - iCrafting.sendProgressBarUpdate truncates to short.
byte[] bytes = intToBytes(i);
int[] mcInts = new int[] { (int) (bytes[0] << 8 | (bytes[1] & 0xFF)),
        (int) (bytes[2] << 8 | (bytes[3] & 0xFF)) };
return mcInts;
StringintToMmss(int ns)
int To Mmss
if (ns < 10)
    return "0:0" + ns;
if (ns < 60)
    return "0:" + ns;
int rem = ns % 60;
if (rem < 10)
    return ns / 60 + ":0" + rem;
else
...
voidintToNetworkByteOrder(int num, byte[] buf, int start, int count)
Encodes an integer into 4 bytes in network byte order in the buffer supplied.
if (count > 4)
    throw new IllegalArgumentException("Cannot handle more than 4 bytes");
for (int i = count - 1; i >= 0; i--) {
    buf[start + i] = (byte) (num & 0xff);
    num >>>= 8;
byte[]intToNetworkByteOrder(int num, int count)
Encodes an integer into up to 4 bytes in network byte order.
byte[] buf = new byte[count];
intToNetworkByteOrder(num, buf, 0, count);
return buf;