Start New Discussion within our Software Development Community

How do you convert a decimal to binary and vice versa? using netbeans ide

Integer.toBinaryString(int) in case you don't have to implement the algorithm yourself.

Also note that if you write e.g. int x = 5; the 5 is actually stored in binary.
System.out.println(x); prints 5 because the binary value in x is converted to base 10 for display.

don't like to roseindia, it's the worst excuse for a programming help website out there.
Or if you link to them, link to them as an example how not to do something.

mvmalderen has the correct answer, unless of course you are receiving a different binary representation from the one that Java is expecting (little endian vs. big endian, etc.).

This article has been dead for over six months. Start a new discussion instead.