Latest :

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 the static method, using recursion, and vice versa conversion from Binary to decimal.

  • What is binary and how it represents?

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 of a binary number is :


  • What is Decimal?

A decimal number system is a 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 the static method to convert decimal to binary.

3. Using Recursion 

Another sample program using recursion method.



4. Using Stack


Check Also

LCM Of Two Numbers Java Program | 5 Ways – Programs

Java program to find the LCM of two numbers – In the below-mentioned java programs, ...