In Java 7:
int i = 0b10101010;
There are no binary literals in older versions of Java (see other answers for alternatives).
More Related Contents:
- Java: Syntax and meaning behind “[B@1ef9157”? Binary/Address?
- Convert binary string to byte array
- Are there binary literals in Java?
- how to define a constructor outside class in java?
- The main thing is: how that binary for example 11110000 is divided into two parts such as s1=1111 and s2=0000. I have to do this in Java
- how to get the first two bytes from a string in java?
- What is the Java ?: operator called and what does it do?
- Is there a difference between x++ and ++x in java?
- Difference between >>> and >>
- How to get 0-padded binary representation of an integer in java?
- What’s the syntax to import a class in a default package in Java? [duplicate]
- Is there a difference between single and double quotes in Java?
- Java for loop syntax: “for (T obj : objects)”
- WITH statement in Java
- How do you embed binary data in XML?
- Converting an int to a binary string representation in Java?
- Converting Decimal to Binary Java
- How to convert a byte to its binary string representation
- Java “?” Operator for checking null – What is it? (Not Ternary!)
- Any Java libraries out there that validate SQL syntax? [closed]
- Modifier Keyword order in Java
- Compare two Byte Arrays? (Java)
- Why is declaration of the variable required inside a for-each loop in java
- Why is this Java code in curly braces ({}) outside of a method?
- XML syntax validation in Java [closed]
- The difference between += and =+
- What’s the difference between this and Activity.this
- What does a tilde in angle brackets mean when creating a Java generic class?
- When would you put a semicolon after a method closing brace?
- My java code has an obvious error. Why does it compile and run?