clampInt method Null safety
Clamps an integer between two integers.
Returns input when min <= input <= max, and either min or max otherwise.
Implementation
static int clampInt(int min, int max, int input) {
if (input < min) {
return min;
} else if (input > max) {
return max;
}
return input;
}