Java Utililty Methods Integer to Byte Array

List of utility methods to do Integer to Byte Array

Description

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

Method

voidintToBytes(byte[] bytes, int index, int value)
int To Bytes
for (int j = 3; j >= 0; j--) {
    bytes[index + j] = (byte) (value & 0xff);
    value >>>= 8;
byte[]intToBytes(final int aInt)
int To Bytes
byte[] wBuffer = new byte[LEN_OF_INT];
appendIntInBuffer(wBuffer, 0, aInt);
return wBuffer;
byte[]intToBytes(final int i)
int To Bytes
return new byte[] { (byte) (i >>> 24), (byte) (i >>> 16), (byte) (i >>> 8), (byte) i };
byte[]intToBytes(final int integer, final int bLength)
convert integer to byte array
if (integer > Integer.MAX_VALUE || integer < Integer.MIN_VALUE) {
    return null;
byte[] bytes = new byte[bLength];
for (int i = 0; i < bLength; i++) {
    bytes[i] = new Integer(integer >> (bLength - 1 - i) * 8).byteValue();
return bytes;
...
byte[]intToBytes(final int number)
TODO: Documentation
return new byte[] { (byte) (number >> 24 & 0xFF), (byte) (number >> 16 & 0xFF), (byte) (number >> 8 & 0xFF),
        (byte) (number & 0xFF) };
byte[]intTobytes(final int value)
int Tobytes
byte[] bytes = new byte[4];
intTobytes(value, bytes);
return bytes;
byte[]intToBytes(final int value)
int To Bytes
final byte[] bytes = new byte[4];
intToBytes(value, bytes, 0);
return bytes;
voidintToBytes(int a, byte[] b, int bo)
int To Bytes
b[bo] = (byte) ((a >> 24) & 0xff);
b[bo + 1] = (byte) ((a >> 16) & 0xff);
b[bo + 2] = (byte) ((a >> 8) & 0xff);
b[bo + 3] = (byte) ((a) & 0xff);
byte[]intToBytes(int i)
Returns a byte array of size 4.
byte[] dword = new byte[4];
dword[0] = (byte) ((i >> 24) & 0x000000FF);
dword[1] = (byte) ((i >> 16) & 0x000000FF);
dword[2] = (byte) ((i >> 8) & 0x000000FF);
dword[3] = (byte) (i & 0x00FF);
return dword;
byte[]intToBytes(int i)
int To Bytes
int j = (Integer.toHexString(i).length() + 1) / 2;
byte abyte0[] = new byte[j];
for (int k = 0; k < j; k++)
    abyte0[k] = (byte) (i >>> 8 * (j - 1 - k) & 0xff);
return abyte0;