toArrayUnsigned

fun Kapacity.toArrayUnsigned(init: (Int) -> UByte = { 0U }): Array<UByte>

Allocates a new boxed Array of UByte with a size equal to this capacity.

Warning on Truncation: Because Kotlin arrays are strictly indexed by Int, the maximum allowed size is Int.MAX_VALUE- 8 (approximately 2.14 GB). If this capacity exceeds that limit, the resulting array size will be silently truncated to Int.MAX_VALUE.

Return

A new boxed Array of UByte.

Parameters

init

A function used to compute the initial value of each array element based on its index.