| Author |
convert byte[] to float
|
Mike Southgate
Ranch Hand
Joined: Jul 18, 2003
Posts: 183
|
|
I'm building an application that collects data over the serial port as a byte[]. I need to parse this array based upon a defined protocol. When it sends a float I get 4 bytes (4 * 8 = 32 bits). How would I convert these bytes into a single float value? Easy for integers... Oops, never mind. I just found the answer posted earlier today (what a coincidence!) ms [ September 16, 2004: Message edited by: Mike Southgate ]
|
ms<br />SCJP, SCJD
|
 |
Stefan Wagner
Ranch Hand
Joined: Jun 02, 2003
Posts: 1923
|
|
Did you read the javadocs for java.lang.Float.intBitsToFloat ()? I would try with that and a lot of test values.
|
http://home.arcor.de/hirnstrom/bewerbung
|
 |
 |
|
|
subject: convert byte[] to float
|
|
|