Microsoft interview question

Coding problem based on endianness.