Java tutorial
//package com.java2s; public class Main { public static float limitValue(float a, float b) { float valve = 0; final float min = Math.min(a, b); final float max = Math.max(a, b); valve = valve > min ? valve : min; valve = valve < max ? valve : max; return valve; } }