Java Convert Decimal to BinaryWe can convert decimal to binary in java using Integer.toBinaryString() method or custom logic. Java Decimal to Binary conversion: Integer.toBinaryString()The Integer.toBinaryString() method converts decimal to binary string. The signature of toBinaryString() method is given below: Let's see the simple example of converting decimal to binary in java. Test it NowOutput: 1010 10101 11111 Java Decimal to Binary conversion: Custom LogicWe can convert decimal to binary in java using custom logic. Test it NowOutput: Decimal of 10 is: 1010 Decimal of 21 is: 10101 Decimal of 31 is: 11111 Next TopicJava Hex to Decimal |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India