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.

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

Thank you very much. I miss this method!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.