private static void WriteInt(FileStream fs, int val) { fs.WriteByte((byte)(val & 0x00ff)); fs.WriteByte((byte)((val & 0x0ff00) >> 8)); fs.WriteByte((byte)((val & 0x0ff0000) >> 16)); fs.WriteByte((byte)((val & 0x0ff000000) >> 24)); }