Int转两个字节
ByteBuffer.allocate(2).putShort(code.toShort()).array()
4个字节转Int
ByteBuffer.wrap(code).getInt()
Bool转Int
var code = true
if (code) 1.toByte() else 0.toByte()
打印ByteBuffer
Log.i(TAG,"byte = ${byte.contentToString()}")
1个字节转Int再转String
code[0].toInt().toChar().toString()