Solved

# Dynamic double array

Posted on 2010-11-16

I have an array updated every second. For practical needs I need to save last 20 values in double array with permanent shifting values from 0 to 19.

Incoming data:

Avg[0] = (openBid[0] + openAsk[0])/2;

After it has to be converted in double array:

Avg[0] = X[0][0];

and then, when new value arrive into X[0][0], value of X[0][0] has to be shifted into the X[0][1];

after each new arriving all values have to be shifted down up to X[0][19] and this process has to be endless (loop);

So, we will have permanently updated dynamic double array list of last 20 values of Avg[0].

Please advice sample of Java code which will shift values from one array member to another.