uli
06/11/2021, 6:54 AMByteArray
with hex literals. Here is my Approach:
val key = intArrayOf(0x80, 0xFF, 0x00, 0x7f).map { it.toByte() }.toByteArray()
And the result is (and should be):
-128,-1,0,127
Is there a more compact/idiomatic way to do that?uli
06/11/2021, 7:03 AMubyteArrayOf(0x80, 0xFF, 0x00, 0x7f).toByteArray()
and neither
ubyteArrayOf(0x80u, 0xFFu, 0x00u, 0x7fu).toByteArray()
gildor
06/11/2021, 7:03 AMgildor
06/11/2021, 7:04 AMgildor
06/11/2021, 7:05 AMbyteArrayOf(0x80.toByte(), 0xFF.toByte(), 0x00, 0x7f)
uli
06/11/2021, 7:09 AMephemient
06/11/2021, 7:11 AMubyteArrayOf(0x80u, 0xFFu, 0x00u, 0x7Fu)
ephemient
06/11/2021, 7:12 AM.toByteArray()
on that if you need, although it makes a copyephemient
06/11/2021, 7:13 AMuli
06/11/2021, 7:15 AMubyteArrayOf(0x80u, 0xFFu, 0x00u, 0x7fu).toByteArray()
error: type of the constant expression cannot be resolved. Please make sure you have the required dependencies for unsigned types in the classpath
uli
06/11/2021, 7:15 AMCLOVIS
06/11/2021, 7:32 AMuli
06/11/2021, 7:46 AM