Here you can find the source of clamp01(double d)
public static double clamp01(double d)
//package com.java2s; //License from project: Open Source License public class Main { public static double clamp01(double d) { if (d < 0) d = 0;//from w ww .j a v a 2 s .c o m else if (d > 1) d = 1; return d; } }