static float clamp(float f,float min,float max){
  return Math.max(min,Math.min(f,max));
}

static float clamp ( float f , float min , float max ) { return Math . max ( min , Math . min ( f , max ) ) ; }
keeps f within min and max . min is of higher priority if min is larger than max .
