title: Check if byte has more than one bit set
body: <p>I'm receiving a 3-byte message back from a serial device when I send it a query in my C# application. The entire message should have at most one bit set, e.g. <code>$04 00 00</code> is fine, but not <code>$04 01 00</code> or <code>$05 00 00</code>.</p>
  
  <p>Bit-shifting and checking each bit is one solution but perhaps there is something more elegant? We can check each byte to see if it's a power of two but I can't come up with a way which looks nicer (not sure about efficiency in these cases either).</p>
  
  <p>As an extension to the problem, I need to match each possible value to an output message, e.g.:<br>
  <code>$01 00 00: Button A pressed</code><br>
  <code>$00 02 00: Lever B pulled</code><br>
  <code>$00 00 04: Switch C activated</code></p>
  
  <p>A case statement is a simple solution, but once again, wondering if there's a pretty way of doing this as well.</p>