I'm trying to output a series binary digits and next series of binary digits depend on the previous series's of binary digits. Some of these series lead with one or more zeroes. I can only use int variables.
So if the program starts with 0, the next output will be 01 and then 0110 and so on.
Will I have to hard code a leading a zero if the int starts with a zero or is there another way I can do this?
Also, is Integer.toBinaryString() the only way to output a number to binary?