Big binary String to a number format

Thread Solved

Join Date: Nov 2007
Posts: 10
Reputation: omeralper is an unknown quantity at this point 
Solved Threads: 1
omeralper omeralper is offline Offline
Newbie Poster

Big binary String to a number format

 
0
  #1
Jan 5th, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 33
Reputation: AlbertPi is an unknown quantity at this point 
Solved Threads: 2
AlbertPi AlbertPi is offline Offline
Light Poster

Re: Big binary String to a number format

 
1
  #2
Jan 6th, 2009
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 10
Reputation: omeralper is an unknown quantity at this point 
Solved Threads: 1
omeralper omeralper is offline Offline
Newbie Poster

Re: Big binary String to a number format

 
0
  #3
Jan 6th, 2009
Thank you very much. I miss this method!
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC