Here you can find the source of clamp(int c)
public static int clamp(int c)
//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; } }