Write a method that parses a binary number as a string into a decimal integer. The method

Question:

Write a method that parses a binary number as a string into a decimal integer. The method header is as follows:
public static int binary to Decimal(String binaryString)
For example, binary string 10001 is 17 (1 x 24 + 0 x 23 + 0 x 22 + 0 x 2 + 1 = 17)
So, binary to Decimal ("10001") returns 17. Note that Integer.parseInt("10001", 2) parses a binary string to a decimal value.
Do not use this method in this exercise.
Write a test program that prompts the user to enter a binary string and displays the corresponding decimal integer value.
Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: