Converting two bytes into a short *solved*

As you may be aware of, shorts are stored in two bytes, integers 4 and so on..

I have been spending a couple of hours (5-7) so far trying to come up with a formula to work this out.

I have test numbers which were converted from a short into two bytes.
byte1: 152
byte2: 58

short value used = 15000
max short value 65536 (including negative)

I just cannot figure out how these two bytes numbers could end up being equal to 15000, knowing this then it may be easier to convert 15000 into the two numbers again.

I'm pretty math illiterate, any help would be fabulous.
Last edited on
(58 * 256) + 152 = 15000
I see. =D

This is awesome, thankyou!
Last edited on
Topic archived. No new replies allowed.