I think this problem already well known in bit shifting, but im not using bit, need solution in actual number(s)
Lets say i have multiple boolean data(b0-bn) can be either true or false, and i need to store them in an integer(name it T)
b0 with value of 1
b1 with value of 2
b2 with value of 4
b3 with value of 8
b4 with value of 16
...
so if all of them are true, then T will have value of 1+2+4+8+16 = 31, if b0 is false then T will have value of 30(2+4+8+16).
now, i need to have a very fast and efficient method to know if certain boolean data is true or false without evaluating from the start or from the end.
like i need a formula to know if b4 is true or false if T is 4923849235649 (assume it has far more than just b0-b4)
please do not offer any bitwise solution.
Storing multiple boolean in an integer