I\'m trying to store a number as a binary string in an array but I need to specify how many bits to store it as.
For example, if I need to store 0 with two bits I ne
Use Integer.toBinaryString() then check the string length and prepend it with as many zeros as you need to make your desired length.
Integer.toBinaryString()