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.
Avg = (openBid + openAsk)/2;
After it has to be converted in double array:
Avg = X;
and then, when new value arrive into X, value of X has to be shifted into the X;
after each new arriving all values have to be shifted down up to X and this process has to be endless (loop);
So, we will have permanently updated dynamic double array list of last 20 values of Avg.
Please advice sample of Java code which will shift values from one array member to another.