Bitshifting to read/write data
<p>I am sending 2 integers as one long in Java, and cannot work out for the life of me how to send these across properly using bit shifting.</p>

<p>I have a method to create the long:</p>

<pre><code>public long create(int one, int two){
return      (one &lt;&lt;32 &amp; two);
}
</code></pre>

<p>First of all, is this correct? (To send the two integers in one long together)</p>

<p>Secondly, if I want to then access either one or two, how do I go about that?</p>

<p>Is it a simple case of:</p>

<pre><code>   public static int getOne(long theLong) {
        return (int)theLong &gt;&gt; 32;

    }
</code></pre>

<p>Or is there something a little more complicated?</p>

<p>Some guidance is much appreciated, thanks!</p>
