Converting 3 bytes to a float
807588Jun 4 2009 — edited Jun 4 2009I need to decode a small byte array containing of size 3 from a binary file. I used the InputStream's read() method to get each byte (which returns an int after each read) and casted them back into byte to put them in a byte array.
I need to represent these 3 bytes as ONE number.
I know that the number is supposed to be -125.000 however, when I use System.out.println(byte[index]) on the three bytes, I get -127, -27, and 72 respectively (printing from byte[0] to byte[2]).
Any ideas on how to convert these bytes into the correct number?