private byte[] UInt32ToBigEndianBytes(UInt32 x) { return new[] { (byte) ((x >> 24) & 0xff), (byte) ((x >> 16) & 0xff), (byte) ((x >> 8) & 0xff), (byte) (x & 0xff) }; }