Here you can find the source of clamp(final float value, final float min, final float max)
Parameter | Description |
---|---|
value | Value to constrain |
min | Min value |
max | Max value |
public static float clamp(final float value, final float min, final float max)
//package com.java2s; //License from project: Open Source License public class Main { /**/* w w w . j av a2s .c o m*/ * Constrains a value between a min and a max * @param value Value to constrain * @param min Min value * @param max Max value * @return Value constrained to between min and max */ public static float clamp(final float value, final float min, final float max) { return (value < min) ? min : ((value > max) ? max : value); } }