int number; byte[] bytes = BitConverter.GetBytes(number); if (BitConverter.IsLittleEndian) Array.Reverse(bytes);