code: public static MathContext getMathContext(MonetaryContext monetaryContext, RoundingMode defaultMode) {
          MathContext ctx = monetaryContext.get(MathContext.class);
          if (ctx!=null) {
              return ctx;
          }
          RoundingMode roundingMode = monetaryContext.get(RoundingMode.class);
          if (roundingMode == null) {
              roundingMode = defaultMode;
          }
          if (roundingMode == null) {
              roundingMode = RoundingMode.HALF_EVEN;
          }
          return new MathContext(monetaryContext.getPrecision(), roundingMode);
      }
docs: Evaluates the {@link MathContext} from the given {@link MonetaryContext}.
  
  @param monetaryContext the {@link MonetaryContext}
  @param defaultMode     the default {@link RoundingMode}, to be used if no one is set
  in {@link MonetaryContext}.
  @return the corresponding {@link MathContext}