store negative float value in byte array using Hex and read back as float
Posted on 2010-01-04
I'm trying to store float value -206800000 or -2.068E8 into a byte array
and read it as a float.
the number in Hex is 0xF3AC7B80
I know I cant just do this as displayed below because the number is negative and it would exceed the limit for a byte value
byte  hexBytes = new byte;
byte = F3;
byte = AC;
byte = 7B;
byte = 80;
I would think I may have to do the 2's compliment for each negative byte, but not sure of the best way to do this.
I would like to store this number(0xF3AC7B80) in an 4 byte byteArray
and then read it out of the byteArray as the float I need it to be so that I end up
with the value -2.068E8
I will be receiving this data from UDP packets