Bitwise AND not calculating the expected value
<p>What am I missing here?</p>

<pre><code>#include &lt;vector&gt;
#include &lt;stdint.h&gt;
#include &lt;iostream&gt;

int main()
{
    uint16_t week = 900;
    std::vector &lt;uint8_t&gt;out;

    out.push_back(0x00ff &amp; week);
    out.push_back(0xff00 &amp; week);

    for (int i = 0; i &lt; out.size(); i++)
    {
        std::cout &lt;&lt; std::hex &lt;&lt; (int)out[i] &lt;&lt; std::endl;
    }

    return 0;
}
</code></pre>

<p><strong>expected output</strong></p>

<p>84<br>
03</p>

<p><strong>actual output</strong></p>

<p>84<br>
00</p>