Using binaries as multiple flags

I’m thinking about using binaries as a sort of multiple flag but I can’t quite get my head around it and haven’t so far managed to google anything useful.

What I’m talking about is something like this:

Say you want to track the on/off state of four switches, each state would be represented by a binary like this:
0001
0010
0100
1000

Then all combinations of these states is represented by another binary, eg:
1001
0110
1110
etc…

I guess what I’m a bit puzzled about is how to check the results. I can think of ways to get there but I’d like to know common methods, or simply the best way to do it.

Any tip is appreciated.