What would be the best way (ideally, simplest) to convert an int to a binary string representation in Java?
For example, say the int is 156. The binary string representation of this would be "10011100".
I have an array of Strings that represent Binary numbers (without leading zeroes) that I want to convert to their corresponding base 10 numbers. Consider:
binary 1011 becomes integer 11
binary 1001 becomes integer 9
binary 11 becomes integer 3 etc.
What's the best way to proceed? …
For example, the bits in a byte B are 10000010, how can I assign the bits to the string str literally, that is, str = "10000010".
Edit
I read the byte from a binary file, and stored in the byte array B. I …