This looks like an off-by-1 error - why are we averaging values.get(i+1) and values.get(i-1), rather than either i and i+1 or i and i-1?