code: public void setGravity(double gravity)
      {
          if(Double.isInfinite(gravity) || Double.isNaN(gravity) || gravity <= 0)
              throw new IllegalArgumentException("Gravity must be positive, not " + gravity);
          this.gravity = gravity;
      }
docs: Sets the gravity regularization parameter that "weighs down" the
  coefficient values. Larger gravity values impose stronger regularization,
  and encourage greater sparsity.
  
  @param gravity the regularization parameter in ( 0, Infinity )