I'm creating an array of FloatBuffers with a for loop like this:
FloatBuffer[] buffer = new FloatBuffer[sizebuffer];
float[] farray = new float[sizeArray];
for(int i=0;i<sizebuffer;i++){
for(int j=0;j<sizeArray;j++){
farray[j]= I get the float values from other buffer....
}
buffer[i]= FloatBuffer.wrap(farray); (*)
}
But for some reason it's changing the values on each row of the FloatBuffer array ("buffer") each time this line (*) is executed. For example, after buffer[0] is given its value, I printed buffer[0].get(0), then after buffer[1] was given its values, I printed buffer[0].get(0) again, but the value had been changed. It's coping the values for each new buffer[i] on each of the previous ones buffer[0], buffer[1]... I don't understand why is this happening?