This should do what you are looking for. BitConverter returns an array of bytes in order of continuation of the processor used. For x86-processors this is of little use. This first puts the least significant byte.
int value; byte[] byte = BitConverter.GetBytes(value); Array.Reverse(byte); byte[] result = byte;
If you do not know the processor that you intend to use the application, I suggest using:
int value; byte[] bytes = BitConverter.GetBytes(value); if (BitConverter.IsLittleEndian){ Array.Reverse(bytes); } byte[] result = bytes;
source share