title: Java Byte Shift
body: <p>I have a byte array that should be treated as 2 bytes of unsigned data.
  So code below represents 257. I am trying to store it as short, but I am getting an error: The left-hand side of an assignment must be a variable. Is there any clever way to do this? Please help.</p>
  
  <pre><code>    byte[] unsigned2ByteNum = new byte[2];
      unsigned2ByteNum[0] = 1;
      unsigned2ByteNum[1] = 1;
  
      short port = 0;
      (byte)(port &gt;&gt; 8) = portNum[0];
      (byte)(port) = portNum[1];
  </code></pre>