If you want to take only 3 bytes of passed int you...
# getting-started
s
If you want to take only 3 bytes of passed int you can
Copy code
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
}