public static boolean isBetween( double value, double... ranges ) {
        boolean even = true;
        for( int i = 0; i < ranges.length; i++ ) {
            if (even) {
                // lower bound
                if (value < ranges[i]) {
                    return false;
                }
            } else {
                // higher bound
                if (value > ranges[i]) {
                    return false;
                }
            }
            even = !even;
        }
        return true;
    }
public static boolean isBetween ( double value , double ... ranges ) { boolean even = true ; for ( int i = 0 ; i < ranges . length ; i ++ ) { if ( even ) { if ( value < ranges [ i ] ) { return false ; } } else { if ( value > ranges [ i ] ) { return false ; } } even = ! even ; } return true ; }
Check if value is inside a ND interval (bounds included).

@param value the value to check.
@param ranges the bounds (low1, high1, low2, high2, ...)
@return <code>true</code> if value lies inside the interval.