writeShortBe

fun ByteArray.writeShortBe(offset: Int, value: Short)

Writes a 16-bit signed integer in big-endian order starting at offset.

The most significant byte of value is stored at offset and the least significant byte at offset + 1. The array is modified in place and no other indices are touched.

Parameters

offset

the index of the first byte to write.

value

the value to encode.

Throws

if offset is negative or offset + 2 exceeds the array size.