List of utility methods to do Integer to Byte Array
void | int32ToArrayInPlace(int data, byte[] buffer, int offset) Convert a 32 bit integer into a byte array, network order. buffer[offset] = (byte) (data >> 24); buffer[offset + 1] = (byte) (data >> 16); buffer[offset + 2] = (byte) (data >> 8); buffer[offset + 3] = (byte) data; |
void | int32ToByteArr(int val, byte[] arr, int offset) int To Byte Arr arr[offset] = (byte) ((0xFF) & (val)); arr[offset + 1] = (byte) ((0xFF) & (val >> 8)); arr[offset + 2] = (byte) ((0xFF) & (val >> 16)); arr[offset + 3] = (byte) ((0xFF) & (val >> 24)); |
byte[] | int32ToByteArray(int a) int To Byte Array byte[] ret = new byte[4]; ret[0] = (byte) (a & 0xFF); ret[1] = (byte) ((a >> 8) & 0xFF); ret[2] = (byte) ((a >> 16) & 0xFF); ret[3] = (byte) ((a >> 24) & 0xFF); return ret; |
byte[] | int32toByteArray(int i) intto Byte Array byte[] output = new byte[4]; output[0] = (byte) ((i & 0xFF000000) >> 24); output[1] = (byte) ((i & 0x00FF0000) >> 16); output[2] = (byte) ((i & 0x0000FF00) >> 8); output[3] = (byte) (i & 0x000000FF); return output; |
byte[] | int32ToByteArray(int integer) int To Byte Array return new byte[] { (byte) integer, (byte) (integer >> 8), (byte) (integer >> 16), (byte) (integer >> 24) }; |
byte[] | int32ToByteArray(int value) Converts an int32 into a 4 byte array return new byte[] { (byte) (value >> 24 & 0xFF), (byte) (value >> 16 & 0xFF), (byte) (value >> 8 & 0xFF), (byte) (value >> 0 & 0xFF) }; |
void | integerToByteArray(final int integerToSerialize, final byte[] byteArray, final int offset) Serializes and writes the given integer number to the provided byte array. for (int i = 0; i < 4; ++i) { final int shift = i << 3; byteArray[offset + 3 - i] = (byte) ((integerToSerialize & 0xff << shift) >>> shift); |
void | integerToByteArray(int a, byte[] buf) Converts an integer to a byte array with a length of 4. buf[0] = (byte) ((a >> 24) & 0xFF); buf[1] = (byte) ((a >> 16) & 0xFF); buf[2] = (byte) ((a >> 8) & 0xFF); buf[3] = (byte) (a & 0xFF); |
byte[] | integerToByteArray(int value) Take the given int value and convert it into a byte array suitable for sending over the network. return new byte[] { (byte) (value >>> 24), (byte) (value >>> 16), (byte) (value >>> 8), (byte) (value) }; |
int | IntegerToBytes(int i, byte[] dst, int offset) Integer To Bytes return IntegerToBytes(i, dst, offset, true, true, false);
|