public static final double keepIn ( double value , double min , double max ) { return Math . max ( min , Math . min ( value , max ) ) ; }
This methods returns the value or min if too small or max if too big .