Java Double Number Clamp clamp(double weight, double lowerBound, double upperBound)

Here you can find the source of clamp(double weight, double lowerBound, double upperBound)

Description

clamp

License

Apache License

Declaration

public static double clamp(double weight, double lowerBound,
            double upperBound) 

Method Source Code

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

public class Main {
    public static double clamp(double weight, double lowerBound,
            double upperBound) {
        if (weight > upperBound) {
            weight = upperBound;//w  w w. j  av  a2  s. c  o m
        } else if (weight < lowerBound) {
            weight = lowerBound;
        }
        return weight;
    }
}

Related

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