List of utility methods to do Number Range Check
boolean | inRange(int num, int from, int to, int flag) in Range return ((flag & MASK_LEFT_BOUND) == 0 ? num > from : num >= from)
&& ((flag & MASK_RIGHT_BOUND) == 0 ? num < to : num <= to);
|
boolean | inRange(int value, int lowerBound, int upperBound) in Range return (lowerBound <= value && value <= upperBound);
|
int | inRange(int value, int min, int max) Return the value v if min <= v <= max, otherwise throw an exception if (value < min) throw new IllegalArgumentException("The value " + value + " is lower than the minimum value of " + min); else if (value > max) throw new IllegalArgumentException( "The value " + value + " is greater than the maximum value of " + max); else return value; |
boolean | inRange(int value, int min, int max) inRange checks if a value is between two other values if (value < min) { return false; if (value > max) { return false; return true; |
int | inRange(int value, int min, int max) Brings an integer into a specified range. return value < min ? min : value > max ? max : value;
|
boolean | inRange(int value, int min, int max) checks if a value is in the range min..max, min+max are included return (value >= min && value <= max);
|
boolean | inRange(int x, int a, int b) in Range return x >= a && x <= b;
|
Boolean | inRange(Integer x1, Integer y1, Integer x2, Integer y2) in Range if (Math.abs(x1 - x2) > 60 || (Math.abs(y1 - y2)) > 60) { return false; } else { return true; |
boolean | inRange(long value, long lowerBound, long upperBound) Validates whether a given value falls inside the given range. return ((value >= lowerBound) && (value <= upperBound));
|
boolean | inrange2(double value, double min, double max) checks if value is between min and max, inclusive. if (max < min) { double t = min; min = max; max = t; return value <= max && value >= min; |