Java Double Number Clamp clamp(double value, double min, double max)

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

Description

Clamp a value to the given range

License

Open Source License

Parameter

Parameter Description
value a parameter
min a parameter
max a parameter

Declaration


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

Method Source Code

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

public class Main {
    /**/*  w  w w . j  av  a 2 s. c o m*/
     * Clamp a value to the given range
     * 
     * @param value
     * @param min
     * @param max
     * @return
     */

    public static double clamp(double value, double min, double max) {
        return Math.max(min, Math.min(max, value));
    }
}

Related

  1. clamp(double value, double low, double high)
  2. clamp(double value, double low, double high)
  3. clamp(double value, double low, double high)
  4. clamp(double value, double min, double max)
  5. clamp(double value, double min, double max)
  6. clamp(double value, double min, double max)
  7. clamp(double value, final double min, final double max)
  8. clamp(double var1, double var2, double var3)
  9. clamp(double weight, double lowerBound, double upperBound)