Program to Convert Binary to Decimal in Java

Convert Binary to Decimal in Java

Here you will get program to convert binary to decimal in java programing. We will convert Binary number to Decimal number in Java by using 2 different methods:

  • using Integer.parseInt() method
  • without using Integer.parseInt()

using Integer.parseInt Syntax:
int DecimalNumber = Integer.parseInt(BinaryNumber, 2);

For example:

int DecimalNumber = Integer.parseInt(“1100”, 2);
System.out.println(“Decimal Number of 1100 is: ” + DecimalNumber);

// Output: Decimal Number of 1100 is: 12

Convert Binary to decimal in Java using Integer.parseInt

Output

Convert Binary to Decimal in Java

 

Binary to decimal without using Integer.parseInt

Output

Convert Binary to Decimal in Java1

 

 

 

Check out our other Java Programming Examples

 

 

 

Leave a Comment

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

Scroll to Top