We are receiving a single 32 bit integer value from a server
{
"value": -1072678909
}
In reality they have packed four separate 1 byte values into this one number so we need to read each byte separately to get its value. in this case...
note: reading from right to left
- The first byte is
00000011(e.g. value of 3) - The second byte is
00111000(e.g. value of 56) - The third byte is
00010000(e.g. value of 16) - The fourth byte is
11000000(e.g. value of 192)
How can we accomplish this in JavaScript?