What is a binary constant?
Category:
technology and computing
programming languages
Integer constants can be written as binary constants, consisting of a sequence of ' 0 ' and ' 1 ' digits, prefixed by ' 0b ' or ' 0B '. The type of these constants follows the same rules as for octal or hexadecimal integer constants, so suffixes like ' L ' or ' UL ' can be applied.
Hereof, what is a binary literal?
Binary literal is an integer whose value is represented in the source code using the binary number system.
Secondly, what means 0b?
More generally, the prefix 0b usually means "binary," the prefix 0 usually means "octal," and the prefix 0x usually means "hexadecimal."
Java added a new feature Binary Literal in Java 7. I allows you to express integral types (byte, short, int, and long) in binary number system. To specify a binary literal, add the prefix 0b or 0B to the integral value. In the following example, we are creating binary literals from integral values.