double addLast(int amt) { double f = 0; for (int i = 0; i < min(data.length, amt); i++) { f += data[i]; } return f; }