toByteArray

Returns a byte array representation of this uuid.

The returned array contains 16 bytes. Each byte in the array sequentially represents the next 8 bits of the uuid, starting from the most significant 8 bits in the first byte to the least significant 8 bits in the last byte.

Since Kotlin

2.0

See also

Samples

import kotlin.uuid.*

fun main() { 
   //sampleStart 
   val uuid = Uuid.fromULongs(0x550E8400E29B41D4uL, 0xA716446655440000uL)
println(uuid.toByteArray().joinToString { it.toHexString() }) // 55, 0e, 84, 00, e2, 9b, 41, d4, a7, 16, 44, 66, 55, 44, 00, 00 
   //sampleEnd
}