question: public void recordTimestamp ( ) { long curTimestamp = System . currentTimeMillis ( ) ; if ( usedFields > 0 ) { long diff = curTimestamp - lastValue ; if ( usedFields == diffs . length ) { long removedValue = diffs [ curPosition ] ; diffs [ curPosition ] = diff ; calculateNewAverage ( removedValue , diff , false ) ; shiftEnd ( ) ; } else { calculateNewAverage ( 0 , diff , true ) ; diffs [ curPosition ] = diff ; shiftEnd ( ) ; } } else if ( lastValue != - 1 ) { long diff = curTimestamp - lastValue ; currentAverage = 0 ; diffs [ curPosition ] = diff ; calculateNewAverage ( 0 , diff , true ) ; shiftEnd ( ) ; } lastValue = curTimestamp ; }
target:  Adds a value and calculates the new average of differences between the values within the window size provided at creation.