Here you can find the source of clamp(double number)
public static double clamp(double number)
//package com.java2s; /*/*from w w w. j ava 2 s. c o m*/ * Texture Generator Library by Andy Gibson * * This software is distributed under the terms of the FSF Lesser * Gnu Public License. It is provided as-is, without any express * or implied warranty, or guarantee of any kind. * */ public class Main { public static int clamp(int number) { if (number > 255) { number = 255; } if (number < 0) { number = 0; } return number; } public static double clamp(double number) { if (number > 1) { number = 1; } if (number < 0) { number = 0; } return number; } }