Converting an int to a binary string representation in Java?

Tyler Treat picture Tyler Treat · Mar 9, 2010 · Viewed 303.4k times · Source

What would be the best way (ideally, simplest) to convert an int to a binary string representation in Java?

For example, say the int is 156. The binary string representation of this would be "10011100".

Answer

Jack picture Jack · Mar 9, 2010
Integer.toBinaryString(int i)