Here you can find the source of clip(int x)
private static int clip(int x)
//package com.java2s; public class Main { private static int clip(int x) { if (x < 0) return 0; if (x > 255) return 255; return x; }/* w w w . j av a 2s.co m*/ }