Converting little endian to int
<p>First of all, I think this question is not C# independent. But can also be used in other languages like C.</p>

<p><hr></p>

<p>I'm now trying to parse a file format which stores integers in 4 bytes little-endian format.
TBH, I don't know how the little-endian format nor big-endian format works.</p>

<p>But I need to convert them into an usable int variable.</p>

<p>For example,
02 00 00 00 = 2</p>

<p>So far, I have this code to convert the first 2 bytes: (I used FileStream.Read to store the raw datas into a buffer variable)</p>

<pre><code>        int num = ((buffer[5] &lt;&lt; 8) + buffer[4]);
</code></pre>

<p>But it will only convert the first two bytes. (02 00 in the example, not 02 00 00 00)</p>

<p>Any kind of help would be appreciated :)</p>
