brain56 brain56 -4 years ago 104
Java Question

Convert float[] to byte[] to float[] again

So what I'm trying to do here is get a

float[]
, convert it to
byte[]
, send it through the network as a datagram packet and then convert it back to a
byte[]
at the receiving terminal.

Now I know I can convert
float[]
to
byte[]
by using the
getBytes[]
method. But I don't know how to reverse the conversion.

Answer Source

I think you want to make use of the ByteBuffer class, which has putFloat and getFloat methods.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download