I need to remove trailing zeros from BigDecimal along with RoundingMode.HALF_UP. For instance,
BigDecimal
RoundingMode.HALF_UP
Value Output 15.3456 <=&
You can use DecimalFormat. For example:
BigDecimal value = new BigDecimal("15.3456").setScale(2, BigDecimal.ROUND_HALF_UP)); String valueString = new DecimalFormat("#.##").format(value); System.out.println(valueString); //15.35
Please try yourself.