Inspectopedia Help

Manual min/max calculation

Reports cases where the minimum or the maximum of two numbers can be calculated using a Math.max() or Math.min() call, instead of doing it manually.


public int min(int a, int b) { return b < a ? b : a; }

After the quick-fix is applied:

public int min(int a, int b) { return Math.min(a, b); }

Use the Disable for float and double option to disable this inspection for double and float types. This is useful because the quick-fix may slightly change the semantics for float/double types when handling NaN. Nevertheless, in most cases this will actually fix a subtle bug where NaN is not taken into account.

New in 2019.2

Inspection options




Disable for float and double



Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3


Java, 233.SNAPSHOT

Last modified: 13 July 2023