title: Conversion of byte array hex to decimal
body: <p>I have a byte array with hexadecimal values, for example:</p>
  
  <pre><code>var b = new byte[] {0x27, 0x01, 0x00, 0x00};
  </code></pre>
  
  <p>I need to convert this to decimal value, but when I used code below, get unexpected result. <strong>Expected is 295, but result is 654376960.</strong></p>
  
  <pre><code>if (BitConverter.IsLittleEndian) Array.Reverse(b);
  //int myInt = b[0] | (b[1] &lt;&lt; 8) | (b[2] &lt;&lt; 16) | (b[3] &lt;&lt; 24);
  int value = BitConverter.ToInt32(b, 0);
  </code></pre>
  
  <p>What's wrong?</p>