-
Type:
Sub-task
-
Resolution: Delivered
-
Priority:
P4
-
Affects Version/s: 21
-
Component/s: core-libs
The methods `Math.clamp()` and `StrictMath.clamp()` are added to conveniently clamp the numeric value between the specified minimum and maximum values. Four overloads are provided in both `Math` and `StrictMath` classes for `int`, `long`, `float`, and `double` types. A `clamp(long value, int min, int max)` overload can also be used to safely narrow a `long` value to `int`.