Bitwise operation
<p>there is 4 properties and each one of them can be activated.  To know which one is activated i receive an int value.  Using bitwise and operation i get 1, 2, 4 or 8 each number correspond to an activated property.</p>

<pre><code>if((state &amp; 1) == 1) {
status = 1;
                } else if ((state &amp; 2) == 2) {
status = 2;
                } else if((state &amp; 4) == 4) {
status = 4;
                } else if((state &amp; 8) == 8) {
status = 8;
                }
</code></pre>

<p>I was wondering if could calculate status with one bitwise operation ?
Thanks.</p>
