BigDecimal b = new BigDecimal(total); b=b.setScale(10, BigDecimal.ROUND_HALF_UP); total=b.doubleValue();