Checks
In Range

The inRange Check

The inRange check tests if a certain number is within a provided range.

Usage:

// This will result in `true`
Checks.inRange(1, 5, 3);
// You can also pass a callback to run upon failure if desired.
// Since 6 is not within 1 and 5, "Out of range" would be printed.
Checks.inRange(1, 5, 6, () -> { System.out.println("Out of range"); });
Last updated on March 9, 2023