Convert four bytes at a specified position in a byte array to a 32-bit signed integer
using System; class BytesToInt32Demo { const string formatter = "{0,5}{1,17}{2,15}"; public static void BAToInt32( byte[ ] bytes, int index ) { int value = BitConverter.ToInt32( bytes, index ); Console.WriteLine( formatter, index, BitConverter.ToString( bytes, index, 4 ), value ); } public static void Main( ) { byte[ ] byteArray = {15, 1, 123, 123, 1, 128, 0, 0, 16, 0, 1, 241, 255, 255, 255, 127 }; BAToInt32( byteArray, 1 ); } }