code: protected void pinField(int field) {
          int max = getActualMaximum(field);
          int min = getActualMinimum(field);
  
          if (fields[field] > max) {
              set(field, max);
          } else if (fields[field] < min) {
              set(field, min);
          }
      }
docs: Adjust the specified field so that it is within
  the allowable range for the date to which this calendar is set.
  For example, in a Gregorian calendar pinning the {@link #DAY_OF_MONTH DAY_OF_MONTH}
  field for a calendar set to April 31 would cause it to be set
  to April 30.
  <p>
  <b>Subclassing:</b>
  <br>
  This utility method is intended for use by subclasses that need to implement
  their own overrides of {@link #roll roll} and {@link #add add}.
  <p>
  <b>Note:</b>
  <code>pinField</code> is implemented in terms of
  {@link #getActualMinimum getActualMinimum}
  and {@link #getActualMaximum getActualMaximum}.  If either of those methods uses
  a slow, iterative algorithm for a particular field, it would be
  unwise to attempt to call <code>pinField</code> for that field.  If you
  really do need to do so, you should override this method to do
  something more efficient for that field.
  <p>
  @param field The calendar field whose value should be pinned.
  
  @see #getActualMinimum
  @see #getActualMaximum