Skip to content

Instantly share code, notes, and snippets.

@PatilShreyas
Last active December 24, 2020 12:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PatilShreyas/a5f384b62a5d3b433c3bcf80226ca7a1 to your computer and use it in GitHub Desktop.
Save PatilShreyas/a5f384b62a5d3b433c3bcf80226ca7a1 to your computer and use it in GitHub Desktop.
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