toHexString

fun ByteArray.toHexString(format: HexFormat = HexFormat.Default): String

Formats bytes in this array using the specified format.

Note that only HexFormat.upperCase and HexFormat.BytesHexFormat affect formatting.

Parameters

format

the HexFormat to use for formatting, HexFormat.Default by default.

Throws

if the result length is more than String maximum capacity.


fun ByteArray.toHexString(startIndex: Int = 0, endIndex: Int = size, format: HexFormat = HexFormat.Default): String

Formats bytes in this array using the specified HexFormat.

Note that only HexFormat.upperCase and HexFormat.BytesHexFormat affect formatting.

Parameters

startIndex

the beginning (inclusive) of the subrange to format, 0 by default.

endIndex

the end (exclusive) of the subrange to format, size of this array by default.

format

the HexFormat to use for formatting, HexFormat.Default by default.

Throws

when startIndex or endIndex is out of range of this array indices.

if the result length is more than String maximum capacity.


fun Byte.toHexString(format: HexFormat = HexFormat.Default): String

Formats this Byte value using the specified format.

Note that only HexFormat.upperCase and HexFormat.NumberHexFormat affect formatting.

Parameters

format

the HexFormat to use for formatting, HexFormat.Default by default.


fun Short.toHexString(format: HexFormat = HexFormat.Default): String

Formats this Short value using the specified format.

Note that only HexFormat.upperCase and HexFormat.NumberHexFormat affect formatting.

Parameters

format

the HexFormat to use for formatting, HexFormat.Default by default.


fun Int.toHexString(format: HexFormat = HexFormat.Default): String

Formats this Int value using the specified format.

Note that only HexFormat.upperCase and HexFormat.NumberHexFormat affect formatting.

Parameters

format

the HexFormat to use for formatting, HexFormat.Default by default.


fun Long.toHexString(format: HexFormat = HexFormat.Default): String

Formats this Long value using the specified format.

Note that only HexFormat.upperCase and HexFormat.NumberHexFormat affect formatting.

Parameters

format

the HexFormat to use for formatting, HexFormat.Default by default.