If you just want values that are below the numeric value of the binary string, keep taking one away from the binary string until you get to 0.
If you want all values that can be represented by that number of binary digits, subtract 1 from the highest number that can be represented by that number of digits until you get to 0.
This kind of question appears on those code katcha sites