Java Integer Clamp clamp(int c)

Here you can find the source of clamp(int c)

Description

Clamp a value to the range 0..255

License

Open Source License

Declaration

public static int clamp(int c) 

Method Source Code

//package com.java2s;

public class Main {
    /**//  w w  w.  j  a  va 2s  .c  om
     * Clamp a value to the range 0..255
     */
    public static int clamp(int c) {
        if (c < 0)
            return 0;
        if (c > 255)
            return 255;
        return c;
    }
}

Related

  1. clamp(final int value, final int min, final int max)
  2. clamp(int a)
  3. clamp(int a, int x, int b)
  4. clamp(int a, int x, int y)
  5. clamp(int amt, int low, int high)
  6. clamp(int c)
  7. clamp(int floor, int ceiling, int value)
  8. clamp(int i, int low, int high)
  9. clamp(int i, int min, int max)