Kotlin
Long to ByteArray Extension
code0xff
2021. 6. 28. 11:44
import java.nio.ByteBuffer
fun Long.toByteArray(): ByteArray {
val buffer: ByteBuffer = ByteBuffer.allocate(java.lang.Long.BYTES)
buffer.putLong(this)
return buffer.array()
}