code: public BigDecimal optBigDecimal(int index, BigDecimal defaultValue) {
          Object val = this.opt(index);
          return JSONObject.objectToBigDecimal(val, defaultValue);
      }
docs: Get the optional BigDecimal value associated with an index. The
  defaultValue is returned if there is no value for the index, or if the
  value is not a number and cannot be converted to a number. If the value
  is float or double, the the {@link BigDecimal#BigDecimal(double)}
  constructor will be used. See notes on the constructor for conversion
  issues that may arise.
  
  @param index
  The index must be between 0 and length() - 1.
  @param defaultValue
  The default value.
  @return The value.