Back to Intellij Community

BigDecimalLegacyMethod

java/java-impl/resources/inspectionDescriptions/BigDecimalLegacyMethod.html

2025.3-rc-2392 B
Original Source

Reports calls to BigDecimal.divide() or BigDecimal.setScale() that use integer constants to specify the rounding mode. Since JDK 1.5, consider using methods that take the RoundingMode enum parameter instead.

Example:

new BigDecimal("42").setScale(2, BigDecimal.ROUND_FLOOR);

After the quick-fix is applied:

new BigDecimal("42").setScale(2, RoundingMode.FLOOR);