Java Integer Clamp clamp(int n, int l, int u)

Here you can find the source of clamp(int n, int l, int u)

Description

clamp

License

Open Source License

Declaration

public static int clamp(int n, int l, int u) 

Method Source Code

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

public class Main {
    public static int clamp(int n, int l, int u) {
        return Math.max(Math.min(n, u), l);
    }/* www . j a  v  a 2 s  .c om*/

    public static float clamp(float n, float l, float u) {
        return Math.max(Math.min(n, u), l);
    }

    public static double clamp(double n, double l, double u) {
        return Math.max(Math.min(n, u), l);
    }
}

Related

  1. clamp(int floor, int ceiling, int value)
  2. clamp(int i, int low, int high)
  3. clamp(int i, int min, int max)
  4. clamp(int min, int val, int max)
  5. clamp(int min, int value, int max)
  6. clamp(int n, int lower, int upper)
  7. clamp(int n, int min, int max)
  8. clamp(int n, int min, int max)
  9. clamp(int num, int min, int max)