This language bar is your friend. Select your favorite languages!
Edit summary for version 37 :
[Java] +DocURL

Version 36

Version 37

Idiom #76 Binary digits from an integer

Create the string s of integer x written in base 2.

E.g. 13 -> "1101"

Idiom #76 Binary digits from an integer

Create the string s of integer x written in base 2.

E.g. 13 -> "1101"

Code
String s = Integer.toBinaryString(x)
Code
String s = Integer.toBinaryString(x)
Doc URL
https://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html#toBinaryString%28int%29