Java Utililty Methods Double Number Between

List of utility methods to do Double Number Between

Description

The list of methods to do Double Number Between are organized into topic(s).

Method

doublebetween(double a, double b, double alpha)
between
return (a + (b - a) * alpha);
booleanbetween(double a, double b, double candidate)
between
double min = Math.min(a, b);
double max = Math.max(a, b);
return candidate >= min && candidate <= max;
booleanbetween(double a, double x, double b)
between
return a <= x && x <= b;
booleanbetween(double value, double end1, double end2)
between
if (end1 <= end2)
    return end1 <= value && value <= end2;
else
    return end1 >= value && value >= end2;
booleanbetween(double value, double min, double max)
between
if (min > max) {
    return value <= min && value >= max;
} else {
    return value >= min && value <= max;
doublebetween(double value, double min, double max)
between
if (min <= value && value <= max)
    return value;
throw new IllegalArgumentException(value + " must be between " + min + " and " + max);
booleanbetween(double value, double value1, double value2)
Returns true if and only if the given value is between value1 and value2.
return (value1 <= value && value <= value2) || (value2 <= value && value <= value1);
booleanbetween(double value1, double value2, double valueObj)
between
return ((valueObj >= value1 && valueObj <= value2) || (valueObj <= value1 && valueObj >= value2));
booleanbetween(double valueToCompare, double leftBoundary, double rightBoundary, double epsilon)
Checks if a value is between two parameters with respect to a little error (epsilon)
if (valueToCompare == leftBoundary || valueToCompare == rightBoundary)
    return true;
if (valueToCompare >= leftBoundary && valueToCompare <= rightBoundary)
    return true;
if (valueToCompare + epsilon < leftBoundary)
    return false;
if (valueToCompare > rightBoundary + epsilon)
    return false;
...
booleanbetween(final double zScore, final int firstIndex, final int secondIndex)
Check if zScore is between is between zScorePercentiles[firstIndex] and zScorePercentiles[secondIndex].
return ((zScore > zScorePercentiles[firstIndex] && zScore <= zScorePercentiles[secondIndex])
        || (zScore < zScorePercentiles[firstIndex] && zScore >= zScorePercentiles[secondIndex]));