title: How can I concatenate two bytes in java?
body: <p>I have an integer called <code>writePos</code> that takes a value between <code>[0,1023]</code>. I need to store it in the last two bytes of a byte array called <code>bucket</code>. So, I figure I need to represent it as a concatenation of the array's last two bytes. </p>
  
  <ol>
  <li><p>How would I go about breaking down <code>writePos</code> into two bytes that, when concatenated and cast into an <code>int</code>, produces <code>writePos</code> again?</p></li>
  <li><p>How would I go about concatenating once I get it broken down into the bytes?</p></li>
  </ol>