954,545 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Big binary String to a number format

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.

omeralper
Newbie Poster
14 posts since Nov 2007
Reputation Points: 10
Solved Threads: 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

AlbertPi
Light Poster
33 posts since Nov 2008
Reputation Points: 9
Solved Threads: 2
 

Thank you very much. I miss this method!

omeralper
Newbie Poster
14 posts since Nov 2007
Reputation Points: 10
Solved Threads: 1
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You