-
-
Save PatilShreyas/a5f384b62a5d3b433c3bcf80226ca7a1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main() { | |
println(120.binary) // 1111000 | |
println(120.octal) // 170 | |
println(120.hexadecimal) // 78 | |
} | |
val Int.binary get() = toString(2) | |
val Int.octal get() = toString(8) | |
val Int.hexadecimal get() = toString(16) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment