<p>I am trying to convert an <code>int</code> into three <code>bytes</code> representing that <code>int</code> (big endian).</p>

<p>I'm sure it has something to do with bit-wise and and bit shifting.  But I have no idea how to go about doing it.</p>

<p>For example:</p>

<pre><code>int myInt;

// some code

byte b1, b2 , b3; // b1 is most significant, then b2 then b3.
</code></pre>

<p>*Note, I am aware that an int is 4 bytes and the three bytes have a chance of over/underflowing.</p>

An int doesn't fit into 3 bytes.  However, assuming that you know these particular ones do:
```
```
byte b1 = (myInt & 0xff);
   myInt >>= 8;
   byte b2 = (myInt & 0xff);
   myInt >>= 8;
   byte b3 = (myInt & 0xff);
```
```