Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (9.5k points)

Below is my code implementation: 

String c = "110010"; 

How to convert the binary string to a value in decimal in Java?

1 Answer

0 votes
by (19.7k points)

You can use Integer.parseInt to convert binary string to int with base two. See the code below:

int decimalValue = Integer.parseInt(c, 2);

Interested in Java? Check out this Java tutorial by Intellipaat. 

Related questions

0 votes
0 answers
0 votes
1 answer
0 votes
1 answer
asked Feb 24, 2021 in Java by sheela_singh (9.5k points)

Browse Categories

...