Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
package metaobjectTest
This is a literal number annotation, an identifier follows a literal
number. The syntax for this annotation is
nbin or nBin or nBIN
in which 'n' is a literal number in base 2. 'n' can have numbers and
underscores but it should start with a number (otherwise the
compiler will consider it as an identifier). The metaobject uses method
Integer.valueOf(n, 2)
to parse the number 'n' in base 2.
object Number_bin
func run {
assert 101bin == 5;
assert 10BIN == 2;
assert 111_111Bin == 63;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment