Java/Kotlin 中 Rust 的 Vec<u8> 是什么?

What is the equivalent of Rust's Vec<u8> in Java/Kotlin?

rust 中与 Java/kotlin 等效的 Vec 类型是什么?

Vec<u8> return [48, 130, 6, 55, 2, 1, 3, 48, 130, 5, 253, 6, 9, 42, 134, 72, 134, ...]生锈了。

我尝试在 kotlin 中使用 ByteArray,但如您所见,很少有元素超出字节范围,它超出了范围。我们应该使用 IntArray 吗?还是别的?

Kotlin 中的 ByteArray 用于有符号字节。如果你想要无符号字节(0-255),你可以使用实验性的UByteArray

val b = ubyteArrayOf(48u,130u,6u,200u)

或从函数return到它

fun getBytes(): UByteArray {
    return ubyteArrayOf(48u,130u,6u,200u)
}