code: public int compareTo(Object o) {
          if(o == null) {
              throw new IllegalArgumentException();
          }
  
          int oTag = ((TIFFField)o).getTag();
  
          if(tag < oTag) {
              return -1;
          } else if(tag > oTag) {
              return 1;
          } else {
              return 0;
          }
      }
docs: Compares this <code>TIFFField</code> with another
  <code>TIFFField</code> by comparing the tags.
  
  <p><b>Note: this class has a natural ordering that is inconsistent
  with <code>equals()</code>.</b>
  
  @throws IllegalArgumentException if the parameter is <code>null</code>.
  @throws ClassCastException if the parameter is not a
  <code>TIFFField</code>.