Here you can find the source of clampMax(double val, double max)
public static double clampMax(double val, double max)
//package com.java2s; //License from project: Open Source License public class Main { public static double clampMax(double val, double max) { return val < max ? val : max; }// ww w .j a v a 2 s . c o m public static float clampMax(float val, float max) { return val < max ? val : max; } public static long clampMax(long val, long max) { return val < max ? val : max; } public static int clampMax(int val, int max) { return val < max ? val : max; } public static short clampMax(short val, short max) { return val < max ? val : max; } public static byte clampMax(byte val, byte max) { return val < max ? val : max; } }