- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java Program to convert binary number to decimal number
Use the parseInt() method with the second parameter as 2 since it is the radix value. The parseInt() method has the following two forms.
static int parseInt(String s) static int parseInt(String s, int radix)
To convert binary to decimal, use the 2nd syntax and add radix as 2, since binary radix is 2.
Integer.parseInt("1110", 2)
Example
public class Demo { public static void main( String args[] ) { // converting to decimal System.out.println(Integer.parseInt("1110", 2)); } }
Output
14
- Related Articles
- Java program to convert decimal number to binary value
- Java program to convert binary number to decimal value
- C++ Program To Convert Decimal Number to Binary
- Python program to convert decimal to binary number
- Convert decimal to binary number in Python program
- Java program to convert decimal number to hexadecimal number
- Java Program to convert hexadecimal number to decimal number
- Java Program to convert octal number to decimal number
- Haskell program to convert a decimal number into a binary number
- C++ program to Convert a Decimal Number to Binary Number using Stacks
- C++ Program to Convert Binary Number to Decimal and vice-versa
- Haskell Program to convert the decimal number to binary using recursion
- Swift program to convert the decimal number to binary using recursion
- Java program to convert decimal number to octal value
- Java program to convert float decimal to Octal number

Advertisements