In this section, you will learn how to convert a binary number into a decimal number. The java.lang package provides the facility to convert the integer data into the binary to decimal.
In this program, you will learn the use of parseLong() method. Define a class "BinaryToDecimal" using the parseLong() method. This method is used to parse the string argument as a signed decimal long. This method has been used for converting a long to a string and a String to a long.
Here is the code of this program:
Output of this program:
Enter the Binary value:
We have 1000s of tutorials on our website. Search Tutorials tutorials on our website.
Posted on: May 31, 2007 If you enjoyed this post then why not add us on Google+? Add us to your Circles