All int literals in the binary number format start with 0b or 0B.
The following are examples of using int literals in the binary number format:
int num1 = 0b10101; int num2 = 0b00011; int num3 = 0b10; int num4 = 0b00000010;
public class Main { public static void main(String[] args) { int num1 = 0b10101; int num2 = 0b00011; int num3 = 0b10; int num4 = 0b00000010; System.out.println(num1);//ww w . j a v a 2s . c o m System.out.println(num2); System.out.println(num3); System.out.println(num4); } }