Convert decimal to binary in java

In this post, we will see how to convert decimal to binary in java.

There are lot of ways to convert decimal to binary in java.Let’s explore them one by one.

Using Integer.toBinaryString() method

You can simply use inbuilt Integer.toBinaryString() method to convert a decimal


Binary representation of 12 : 1100
Binary representation of 32 : 100000
Binary representation of 95 : 1011111

Using iterative array approach


Enter a decimal number
Binary representation is : 1100

Using stack


Enter decimal number:
Binary representation is : 100000

That’s all convert decimal to binary in java.

Was this post helpful?


You may also like:

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe to our newletter

Get quality tutorials to your inbox. Subscribe now.