DeepSource has joined Harness. Learn more
Java logoJava/
JAVA-E0080

Incorrect combination of `Math.max` and `Math.min`JAVA-E0080

Critical severityCritical
Bug Risk categoryBug Risk

This code tries to limit the value bounds using a construct such as:

Math.min(0, Math.max(100, value))

However, the order of the constants is incorrect. It should actually be:

Math.min(100, Math.max(0, value))

As the result this code always produces the same result (the constant in min or NaN if the value is NaN).