I have a byte of array which receive UDP packets and I convert it to float array , the problem is that in every iteration it clear the array and write the packets that received there while I want to add new packets to array !
I use this code :
float[] receive = new float[] {}
how should I change this to add receiving packets to my array ?
I assume every time a UDP packet is received, you are putting the data into that array which explains why it gets erased at every iteration.
Use a
ByteArrayOutputStreamto save the received bytesOnce done, you can get all received bytes by doing:
And then do the
floatconversion