Java Double Number Clip clip(double value, double min, double max)

Here you can find the source of clip(double value, double min, double max)

Description

clip

License

LGPL

Parameter

Parameter Description
value The value
min The min value
max The max value

Return

The clipped value between min and max

Declaration

public static double clip(double value, double min, double max) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

public class Main {
    /**/*from  w  w w  .j  a  v a 2s.  c  o m*/
     * @param value The value
     * @param min   The min value
     * @param max   The max value
     * @return The clipped value between min and max
     */
    public static double clip(double value, double min, double max) {
        if (value > max)
            value = max;
        if (value < min)
            value = min;
        return value;
    }
}

Related

  1. clip(double v, double min, double max)
  2. clip(double value, double min, double max)
  3. clip(double[] values, double min, double max)
  4. clip(final double n, final double minValue, final double maxValue)
  5. clip(final double value, final double min, final double max)