All BigDecimal operations allow to set precision (number of digits after decimal point) and rounding mode.
System.out.println(
new BigDecimal(1).divide(new BigDecimal(3), 10, RoundingMode.HALF_UP));
will output 0.3333333333
. You can create a MathContext object to encapsulate this information. This is helpful since you typically need to do several operations with the same precision and rounding settings.
MathContext mc = new MathContext(10, RoundingMode.HALF_UP);
System.out.println(new BigDecimal(1).divide(new BigDecimal(3), mc));
System.out.println(new BigDecimal(1).divide(new BigDecimal(9), mc));