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

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

Description

clamp

License

Apache License

Declaration

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

Method Source Code

//package com.java2s;
/**/*  www .  j  a  va  2  s . com*/
 * Part of campskeleton: http://code.google.com/p/campskeleton/
 * 
 * Original Copyright Notice: http://www.apache.org/licenses/LICENSE-2.0
 * 
 * 
 * @author twak
 */

public class Main {
    public static double clamp(double a, double min, double max) {
        return a < min ? min : a > max ? max : a;
    }

    public static int clamp(int a, int min, int max) {
        return a < min ? min : a > max ? max : a;
    }
}

Related

  1. clamp(double d, double min, double max)
  2. clamp(double d, double min, double max)
  3. clamp(double d, double min, double max)
  4. clamp(double d, double min, double max)