以下:
new MathContext(precision, RoundingMode.HALF_UP);
動作するようです。ただし、次の場合はエラーが返されます。
new MathContext(precision, BigDecimal.ROUND_HALF_UP);
エラー:
java: no suitable constructor found for MathContext(int,int)
constructor java.math.MathContext.MathContext(java.lang.String) is not applicable
(actual and formal argument lists differ in length)
constructor java.math.MathContext.MathContext(int,java.math.RoundingMode) is not applicable
(actual argument int cannot be converted to java.math.RoundingMode by method invocation conversion)
constructor java.math.MathContext.MathContext(int) is not applicable
(actual and formal argument lists differ in length)