Similar to how you can define an integer constant in hexadecimal or octal, can I do it in binary?
I admit this is a really easy (and stupid) question. My google sea
In Java 7:
int i = 0b10101010;
There are no binary literals in older versions of Java (see other answers for alternatives).
Search for "Java literals syntax" on Google and you come up with some entries.
There is an octal syntax (prefix your number with 0), decimal syntax and hexadecimal syntax with a "0x" prefix. But no syntax for binary notation.
Some examples:
int i = 0xcafe ; // hexadecimal case
int j = 045 ; // octal case
int l = 42 ; // decimal case