From → To | Expression |
---|---|
45 → "45" | data.toString |
45 → "101101" | BigInt(data).toString(2) |
45 → "2d" | BigInt(data).toString(16) |
45 → Array[Byte](0, 0, 0, 0x2d) | |
"45" → 45 | data.toInt |
"45" → "3435" | data.map(BigInt(_).toString(16)).mkString |
"101101" → 45 | BigInt(data, 2).toInt |
"2d" → 45 | BigInt(data, 16).toInt |
"2d" → Array[Byte](0x2d) | |
Array[Byte](0, 0, 0, 0x2d) → 45 | |
Array[Byte](0x2d) → "2d" | |
"3435" → "45" | data.grouped(2).map(BigInt(_, 16).toChar).mkString |
This is a fork of a similar chart for Python - https://gist.github.com/Nurdok/4096182 - There are a few missing rows because I'm not sure I know Python well enough to get exactly what those conversions are trying to accomplish.