Beginners Programs :

Java Program To Convert Decimal To Binary | Vice Versa

Java program to convert decimal to binary. Here is the following code that you are searching for it. The following program has been written in three different ways using arrays, using static method, using recursion, and vice versa conversion from Binary to decimal.

  • What is binary and how it represent ?

A binary number is a number expressed in the base 2 numeral system. A Binary Number is made up of only 0s and 1s.

Example for binary number is :


  • What is Decimal ?

Decimal number system is term with base 10. It’s most commonly used number system.  The decimal number system consists of 10 digits from 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.

1. Java Code Using Arrays 

Here is the program using arrays with sample outputs.


2. Using static Method

  • There you go another program using static method to convert decimal to binary.

3. Using Recursion 

Another sample program using recursion method.



4. Using Stack