Last active
April 17, 2025 03:14
-
-
Save yuhki50/ca8363c0bee588cd79ad6637edfaedf3 to your computer and use it in GitHub Desktop.
Kotlin intArray to byteArray
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val ints = intArrayOf(0x01, 0xFF) | |
val bytes = ints.foldIndexed(ByteArray(ints.size)) { i, a, v -> a.apply { set(i, v.toByte()) } } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment