Here you can find the source of clamp(final float min, final float x, final float max)
public static float clamp(final float min, final float x, final float max)
//package com.java2s; //License from project: Open Source License public class Main { /** Clamps the input x between min and max */ public static float clamp(final float min, final float x, final float max) { return Math.max(min, Math.min(x, max)); }/* w ww .j a v a 2 s .c om*/ }