Double modulus=0.5; //系数
private static Long getExpect(List<Integer> list, int year, int start, int end) {
if (list.size() < 1 || modulus <= 0 || modulus >= 1) {
return null;
}
Double modulusLeft = 1 - modulus;
Double lastIndex = list.get(0) * 1.0;
Double lastSecIndex = list.get(0) * 1.0;
for (int i = start; i <= end; ++i) {
if (list.get(i) == 0) {
continue;
}
lastIndex = modulus * list.get(i) + modulusLeft * lastIndex;
lastSecIndex = modulus * lastIndex + modulusLeft * lastSecIndex;
}
Double a = 2 * lastIndex - lastSecIndex;
Double b = (modulus / modulusLeft) * (lastIndex - lastSecIndex);
Double ret = a + b * year;
if (ret < 0) {
ret = 0d;
}
Long reLong = ret.longValue();
if (ret - reLong >= 0.5) {
reLong += 1;
}
return reLon