/**
* Convert an int into its little-endian byte string representation.
*
* @param array the array in which to store the byte string.
* @param offset the offset in the array where the string will start.
* @param value the value to convert.
*/
public static void bytesFromInt(byte[] array, int offset, int value) {
array[offset+0] = (byte) ((value>>0) &0xFF);
array[offset+1] = (byte) ((value>>8) &0xFF);
array[offset+2] = (byte) ((value>>16)&0xFF);
array[offset+3] = (byte) ((value>>24)&0xFF);
}
No comments:
Post a Comment