code: public static BigDecimal getBigDecimal(Number num, MonetaryContext moneyContext) {
      	BigDecimal bd = getBigDecimal(num);
          if (moneyContext!=null) {
              MathContext mc = getMathContext(moneyContext, RoundingMode.HALF_EVEN);
              bd = new BigDecimal(bd.toString(), mc);
              if (moneyContext.getMaxScale() > 0) {
                  LOG.fine(String.format("Got Max Scale %s", moneyContext.getMaxScale()));
                  bd = bd.setScale(moneyContext.getMaxScale(), 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}