Java Double Number Between between(double value, double value1, double value2)

Here you can find the source of between(double value, double value1, double value2)

Description

Returns true if and only if the given value is between value1 and value2.

License

Open Source License

Parameter

Parameter Description
value the value to be checked
value1 the border of the interval
value2 the border of the interval.

Return

true if and only if the given value is between value1 and value2

Declaration

public static boolean between(double value, double value1, double value2) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**//from w w  w.  j  ava 2s .c  o  m
     * Returns true if and only if the given value is between value1 and value2. It doesn't matter 
     * if value1 is bigger than value2 or vica-versa.
     * 
     * @param value the value to be checked
     * @param value1 the border of the interval
     * @param value2 the border of the interval.
     * @return  true if and only if the given value is between value1 and value2
     */
    public static boolean between(double value, double value1, double value2) {
        return (value1 <= value && value <= value2) || (value2 <= value && value <= value1);
    }
}

Related

  1. between(double a, double b, double candidate)
  2. between(double a, double x, double b)
  3. between(double value, double end1, double end2)
  4. between(double value, double min, double max)
  5. between(double value, double min, double max)
  6. between(double value1, double value2, double valueObj)
  7. between(double valueToCompare, double leftBoundary, double rightBoundary, double epsilon)
  8. between(final double zScore, final int firstIndex, final int secondIndex)
  9. betweenOrEqual(double max, double min, double val)