private double fixToRange(double x,double minX,double maxX){
  if (minX > maxX) {
    throw new IllegalArgumentException("Requires 'minX' <= 'maxX'.");
  }
  if (x < minX) {
    return minX;
  }
 else   if (x > maxX) {
    return maxX;
  }
 else {
    return x;
  }
}

private double fixToRange ( double x , double minX , double maxX ) { if ( minX > maxX ) { throw new IllegalArgumentException ( "Requires 'minX' <= 'maxX'." ) ; } if ( x < minX ) { return minX ; } else if ( x > maxX ) { return maxX ; } else { return x ; } }
a utility method that adjusts a value , if necessary , to be within a specified range .
