Java tutorial
//package com.java2s; import java.nio.*; public class Main { /** * Converts a given integer to byte, in little endian * @param i An integer to be converted to byte * @return A byte array stores byte representation of given integer */ public static byte[] intToByte(int i) { ByteBuffer b = ByteBuffer.allocate(4); b.order(ByteOrder.LITTLE_ENDIAN); b.putInt(i); byte buf[] = b.array(); return buf; } }