Skip to content

Instantly share code, notes, and snippets.

@PatilShreyas

PatilShreyas/ExtProp.kt Secret

Last active Dec 24, 2020
Embed
What would you like to do?
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