code: public static BigDecimal getBigDecimal(Number num, MonetaryContext moneyContext) {
      	BigDecimal bd = getBigDecimal(num);
          if (Objects.nonNull(moneyContext)) {
              MathContext mc = getMathContext(moneyContext, HALF_EVEN);
              bd = new BigDecimal(bd.toString(), mc);
              int maxScale = moneyContext.getMaxScale();
              if (maxScale > 0) {
                  if (bd.scale() > maxScale) {
                      if (LOG.isLoggable(FINEST)) {
                          LOG.log(FINEST, "The number scale is " + bd.scale() + " but Max Scale is " + maxScale);
                      }
                      bd = bd.setScale(maxScale, mc.getRoundingMode());
                  }
              }
          }
          return bd;
      }
docs: Creates a {@link BigDecimal} from the given {@link Number} doing the
  valid conversion depending the type given, if a {@link MonetaryContext}
  is given, it is applied to the number returned.
  
  @param num the number type
  @return the corresponding {@link BigDecimal}