fork(9) download
  1. import java.math.BigDecimal;
  2. public class Main{
  3. public static void main(String ar[]){
  4. BigDecimal bd = new BigDecimal("1.23456789");
  5. System.out.println(bd.setScale(3,BigDecimal.ROUND_HALF_UP));
  6. }
  7. }
Success #stdin #stdout 0.03s 245632KB
stdin
Standard input is empty
stdout
1.235