title: Combine two 3 byte integers, and one 2 byte integer into one 8 byte integer
body: <p>Trying to store three integers into one to use for a hash, and decode back into their original values.</p>
  <p>The variables:</p>
  <pre><code>x = 3 byte integer (Can be negative)
  z = 3 byte integer (Can be negative)
  y = 2 byte integer (Cannot be negative)
  </code></pre>
  <p>My current code - doesn't work with negatives:</p>
  <pre><code>long combined = (y) | (((long) z) &lt;&lt; 16) | ((((long) x)) &lt;&lt; 40);
  int newX = (int) (combined &gt;&gt; 40); // Trim off 40 bits, leaving the heading 24
  int newZ = (int) ((combined &lt;&lt; 24) &gt;&gt; (40)); // Trim off 24 bits left, and the 16 bits to the right
  int newY = (int) ((combined &lt;&lt; 48) &gt;&gt; 48); // Trim off all bits other then the first 16
  </code></pre>