Java Double Number Clamp clamp(double value, double low, double high)

Here you can find the source of clamp(double value, double low, double high)

Description

clamp

License

LGPL

Declaration

public static double clamp(double value, double low, double high) 

Method Source Code

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

public class Main {
    public static double clamp(double value, double low, double high) {
        if (value < low) {
            return low;
        }/*from   www. ja va  2s.  c o m*/
        if (value > high) {
            return high;
        }
        return value;
    }

    public static int clamp(int value, int low, int high) {
        if (value < low) {
            return low;
        }
        if (value > high) {
            return high;
        }
        return value;
    }
}

Related

  1. clamp(double val)
  2. clamp(double val, double min, double max)
  3. clamp(double val, double min, double max)
  4. clamp(double value)
  5. clamp(double value)
  6. clamp(double value, double low, double high)
  7. clamp(double value, double low, double high)
  8. clamp(double value, double min, double max)
  9. clamp(double value, double min, double max)