private static int getIntFromByteArray(byte[] bytes, int index)
{
byte[] intInBytes = new byte[4];
Array.Copy(bytes, index, intInBytes, 0, 4);
//
// TODO: after some checking remove
//
// MSDN states that we should check architecture but I found that the values in the byte array are
// in the correct order
//
// If the system architecture is little-endian (that is, little end first),
// reverse the byte array.
/*
if (BitConverter.IsLittleEndian)
Array.Reverse(intInBytes);
*/
return BitConverter.ToInt32(intInBytes, 0);
}