Java Double Number Clamp clamp01(double value)

Here you can find the source of clamp01(double value)

Description

clamp

License

Open Source License

Declaration

public static double clamp01(double value) 

Method Source Code

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

public class Main {
    public static double clamp01(double value) {
        return clamp(value, 0.0, 1.0);
    }/*w w w . j a  va  2  s  . com*/

    public static double clamp(double value, double min, double max) {
        if (value < min) {
            return min;
        } else if (value > max) {
            return max;
        }
        return value;
    }

    public static int clamp(int value, int min, int max) {
        if (value < min) {
            return min;
        } else if (value > max) {
            return max;
        }
        return value;
    }
}

Related

  1. clamp(double x, double min, double max)
  2. clamp(double x, double xMin, double xMax)
  3. clamp(final double value, final double min, final double max)
  4. clamp(final double value, final double min, final double max)
  5. clamp01(double d)
  6. clamp255d(double d)
  7. clamp_double(double num, double min, double max)
  8. clamp_double(double p_151237_0_, double p_151237_2_, double p_151237_4_)
  9. clamp_doubleback(double a, double x, double y)