Does Scala have a built in formatter for binary data?
For example to print out: 00000011 for the Int value 3.
Writing one won't be difficult - just curious if it exists.
scala> 3.toBinaryString res0: String = 11
Scala has an implicit conversion from Int to RichInt which has a method toBinaryString. This function does not print the leading zeroes though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With