Login

//ERDDAP/com.cohort.util/ScriptMath2/unsignedByte

unsignedByte

[JVM]
fun unsignedByte(b: Int): Int

Safely converts a signed byte (-128..127) to an unsigned byte (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

an int (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)