You need to look at the content of the 32bit data as two sets of 16bit datums.
Something like this might work for you;
using System;
namespace BitStuff {
class Program {
static void Swap(ref byte a, ref byte b) {
var temp = a;
a = b;
b = temp;
}
static byte[] FlipInt16(byte[] rawData) {
for (var i = 0; i < rawData.Length; i += 2)
Swap(ref rawData[i], ref rawData[i + 1]);
return rawData;
}
static byte[] FlipInt32(byte[] rawData) {
for (var i = 0; i < rawData.Length; i += 4) {
Swap(ref rawData[i + 0], ref rawData[i + 2]);
Swap(ref rawData[i + 1], ref rawData[i + 3]);
}
return rawData;
}
static void Main(string[] args) {
var b = new byte[] { 0, 0, 0, 55 };
Console.WriteLine("Original: {0}", BitConverter.ToString(b));
if (BitConverter.IsLittleEndian) {
FlipInt32(b);
}
Console.WriteLine("Adjusted: {0}", BitConverter.ToString(b));
}
}
}
Hope this helps,
Fredrik