class MathExt {

    public static double between(double value, double min, double max) {
        Preconditions.checkArgument(min <= max, "min must be less than or equal to max");
        return Math.max(Math.min(value, max), min);
    }

}