semoro
10/04/2016, 3:23 PMval tmp = ByteBuffer.allocate(4)
/**
* @param i Int to convert to bytes
* @param n Number of bytes to take
*/
fun intToBytes(i: Int, n:Int): ByteArray {
tmp.clear()
tmp.putInt(i)
tmp.flip()
val out = ByteArray(n)
tmp.get(out, 0, n)
return out
}