Here you can find the source of clip(double v, double min, double max)
public static double clip(double v, double min, double max)
//package com.java2s; //License from project: Open Source License public class Main { /**/* w w w . j a v a 2 s.co m*/ * Limits the range of v to be between min and max. */ public static double clip(double v, double min, double max) { if (v < min) return min; if (v > max) return max; return v; } /** * Limits the range of v to be between min and max. */ public static int clip(int v, int min, int max) { if (v < min) return min; if (v > max) return max; return v; } }