Java

Java

Made by DeepSource

Incorrect combination of Math.max and Math.min JAVA-S0080

Bug risk
Critical

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).