This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
How can I convert it back to binary string later on? I do not see toBinaryString() method in BigInteger class? I can convert veryLongBinaryString to Long/Integer because string is very very long and I get NumberFormatException on trying to convert to Long/Integer.
There is no toBinaryString() method, but there is a bitLength() method that tells you how many bits there are, and a testBit(int) method that tells you the state of each bit. So create a StringBuilder, store bitLength() in a variable "n", then in a for loop check each bit from n-1 to 0 and append the appropriate "1" or "0" to the StringBuilder. Put this little code snippet into a method and keep it in your personal toolbox for future use!