private float calcAverage(float[] arr, int len) {
    float sum = 0;
    for (int i = 0; i < len; i++) {
      sum += arr[i];
    }
    return (len > 0) ? sum / len : 0;
  }
Handles the given motion event.

@param event event to handle
@return whether or not the event was handled
samples/gestures/src/main/java/com/facebook/samples/gestures/TransformGestureDetector.java