Login

//ERDDAP/com.cohort.util/ScriptMath2/byteToChar

byteToChar

[JVM]
fun byteToChar(b: Int): Char

Safely converts a byte (-128..127) to char (0..255). Note that reverse is easy: (byte)ch works (for 0..255) because narrowing just saves the low order bits, so >127 becomes negative bytes.

Return

a char (0..255)

Parameters

JVM

ba byte (-128 .. 127) (or char, short, or int where you just want the lower 8 bits stored as 0..255)