private float clampMag(float value,float absMin,float absMax){
  final float absValue=Math.abs(value);
  if (absValue < absMin)   return 0;
  if (absValue > absMax)   return value > 0 ? absMax : -absMax;
  return value;
}

private float clampMag ( float value , float absMin , float absMax ) { final float absValue = Math . abs ( value ) ; if ( absValue < absMin ) return 0 ; if ( absValue > absMax ) return value > 0 ? absMax : - absMax ; return value ; }
clamp the magnitude of value for absmin and absmax . if the value is below the minimum , it will be clamped to zero . if the value is above the maximum , it will be clamped to the maximum .
