Back to Intellij Community

BadOddness

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

2025.3-rc-2168 B
Original Source

Reports odd-even checks of the following form: x % 2 == 1. Such checks fail when used with negative odd values. Consider using x % 2 != 0 or (x & 1) == 1 instead.