Java Integer Clamp clamp_int(int num, int min, int max)

Here you can find the source of clamp_int(int num, int min, int max)

Description

Returns the value of the first parameter, clamped to be within the lower and upper limits given by the second and third parameters.

License

Open Source License

Declaration

public static int clamp_int(int num, int min, int max) 

Method Source Code

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

public class Main {
    /**/* w w w . j  a  va 2  s .com*/
     * Returns the value of the first parameter, clamped to be within the lower and upper limits given by the second and
     * third parameters.
     */
    public static int clamp_int(int num, int min, int max) {
        return num < min ? min : (num > max ? max : num);
    }
}

Related

  1. clamp(int value, int minValue, int maxValue)
  2. clamp(int var, int min, int max)
  3. clamp(int x, int min, int max)
  4. clamp(int x, int min, int max)
  5. clamp(String string, int maxChars)
  6. clamp_wrap(int a, int x, int y)
  7. clampAngle(int angle)
  8. clampByte(int in)
  9. clampColor(int c)