0

We can convert any kind of numbers to binary string. For example 20501487 can be converted into binary String format as 1001110001101001111101111. However I cannot reconvert this binary String into any number format, even long or float numbers due to NumberFormatException, where the numbers are very big to convert.
I couldn't find any usable method in Biginteger class. Anybody can help me to convert such a big binary numbers from string format to any number format.

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by omeralper
1

BufferedReader br1 = new BufferedReader(new InputStreamReader(System.in));

System.out.println("Enter the binary value:");
String s = br1.readLine();
System.out.println("Decimal value is : "+Integer.parseInt(s, 2));


Albert

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.