Java Integer Clamp clamp(int n, int min, int max)

Here you can find the source of clamp(int n, int min, int max)

Description

clamp

License

LGPL

Declaration

public static int clamp(int n, int min, int max) 

Method Source Code

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

public class Main {
    public static int clamp(int n, int min, int max) {
        if (n > max)
            return max;
        if (n < min)
            return min;
        return n;
    }/*ww w . jav  a2s  .  com*/
}

Related

  1. clamp(int i, int min, int max)
  2. clamp(int min, int val, int max)
  3. clamp(int min, int value, int max)
  4. clamp(int n, int l, int u)
  5. clamp(int n, int lower, int upper)
  6. clamp(int n, int min, int max)
  7. clamp(int num, int min, int max)
  8. clamp(int number, int low, int high)
  9. clamp(int ptr, int size)