Integer.toBinaryString() - 4 bits every time
807601Mar 3 2008 — edited Mar 3 2008Hello,
I am using the Integer.toBinaryString() method to convert ints between 1 and 14 into binary.I would like them to be 4 bits long every time, i.e 2 = 0010. At the moment a 2 would be represented as 10. I need them as 4 bits because i will be concatenating 6 of these binary strings together, and losing length will completely mess up the final binary string.
Thanks