Challenge: Set Integer Bytes
Test your knowledge by solving this coding challenge.
We'll cover the following...
We'll cover the following...
The reverseBytes
function
The input is an unsigned integer, and you must reverse the order of its bytes.
To understand this, let’s assume the input is in hex. The beauty of the hexadecimal system is that we can view the bytes individually as opposed to the decimal system.
For example, if we take the number 3735928559
, we can’t know the value of each of the 4 bytes just by looking at the number.
We could convert it into binary, but this still requires one extra operation, and binary is a bit hard to read.
Let’s use base 16 or hex. Its value is DEADBEEF
...