Java Integer Clamp clamp(int value, int low, int high)

Here you can find the source of clamp(int value, int low, int high)

Description

Clamps the supplied value to between low and high (both inclusive).

License

Apache License

Declaration

public static int clamp(int value, int low, int high) 

Method Source Code

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

public class Main {
    /**//  w  w w  . j a  v  a 2 s .  c  om
     * Clamps the supplied {@code value} to between {@code low} and {@code high} (both inclusive).
     */
    public static int clamp(int value, int low, int high) {
        if (value < low)
            return low;
        if (value > high)
            return high;
        return value;
    }
}

Related

  1. clamp(int v, int min, int max)
  2. clamp(int val, int min, int max)
  3. clamp(int value, final int minimum, final int maximum)
  4. clamp(int value, int a, int b)
  5. clamp(int value, int low, int high)
  6. clamp(int value, int min, int max)
  7. clamp(int value, int min, int max)
  8. clamp(int value, int min, int max)
  9. clamp(int value, int min, int max)