semoro
val tmp = ByteBuffer.allocate(4) fun intTo3Bytes(i: Int): ByteArray { tmp.clear() tmp.putInt(i) tmp.flip() val out = ByteArray(3) tmp.get(out, 0, 3) return out }