Print an integer in binary format in Java

Assuming you mean “built-in”:

int x = 100;
System.out.println(Integer.toBinaryString(x));

See Integer documentation.

(Long has a similar method, BigInteger has an instance method where you can specify the radix.)

Leave a Comment