title: Converting byte array (char array) to an integer type (short, int, long)
body: <p>I was wondering if system endianness matters when converting a byte array to a short / int / long. Would this be incorrect to do if the code runs on both big-endian and little-endian machines?</p>
  
  <pre><code>short s = (b[0] &lt;&lt; 8) | (b[1]);
  int i = (b[0] &lt;&lt; 24) | (b[1] &lt;&lt; 16) | (b[2] &lt;&lt; 8) | (b[3])
  </code></pre>