24bits just mean there are 24 bits(zeros or ones) that together create a binary number.
If you want all combinations, or all numbers that can be expressed with 24 bits, it is just range from 0 to 16777215. Why? here is the table in format (binary = decimal):
000000000000000000000000 = 0
000000000000000000000001 = 1
000000000000000000000010 = 2
000000000000000000000011 = 3
....
....
111111111111111111111110 = 16777214
111111111111111111111111 = 16777215
you dont really need to generate anything. You can check the binary to decimal here: http://www.binaryhexconverter.com/binary-to-decimal-converter
Another thing: Sometimes in binary, the leading zeros are omitted. So decimal three is not 000000000000000000000011 but rather just 11. If the length is 24 and first digit is 1, its still just range 8388608 - 16777215