hello guys!
so this is my first programming course and i have an assignment to convert a binary number entered by the user to a decimal. and my binary number should be stored in a a
string.
and to check that all my digits are 1s and 0s i need to use a method to make sure it's valid and return true if the the number is correct and false otherwise.
so i did a search and saw that everyone was using the integer.parseInt(String , int radix) method to convert a binary string to int which worked completely fine, however, the only problem is we didn't take this with my professor so I'm not sure if it's OK and that maybe he wants another way to convert ? so my question is: how can i write this code in another way that doesn't use this method?.
here's my code:
this is my output:
enter a binary number to convert to decimal:
110101
the equivalent decimal value is: 53
thank you in advance