Here you can find the source of inrange2(double value, double min, double max)
Parameter | Description |
---|---|
value | the value to check |
min | the minimal possible value |
max | the maximal possible value |
public static boolean inrange2(double value, double min, double max)
//package com.java2s; //License from project: Open Source License public class Main { /**/* w w w.j a v a2 s. co m*/ * checks if value is between min and max, inclusive. automatically swaps min and max if needed * @param value the value to check * @param min the minimal possible value * @param max the maximal possible value * @return if value is between or equal to min and max */ public static boolean inrange2(double value, double min, double max) { if (max < min) { double t = min; min = max; max = t; } return value <= max && value >= min; } }