private void insertAdobeMarkerSegment(AdobeMarkerSegment newGuy){
  boolean hasJFIF=(findMarkerSegment(JFIFMarkerSegment.class,true) != null);
  int lastUnknown=findLastUnknownMarkerSegmentPosition();
  if (hasJFIF) {
    markerSequence.add(1,newGuy);
  }
 else   if (lastUnknown != -1) {
    markerSequence.add(lastUnknown + 1,newGuy);
  }
 else {
    markerSequence.add(0,newGuy);
  }
}

private void insertAdobeMarkerSegment ( AdobeMarkerSegment newGuy ) { boolean hasJFIF = ( findMarkerSegment ( JFIFMarkerSegment . class , true ) != null ) ; int lastUnknown = findLastUnknownMarkerSegmentPosition ( ) ; if ( hasJFIF ) { markerSequence . add ( 1 , newGuy ) ; } else if ( lastUnknown != - 1 ) { markerSequence . add ( lastUnknown + 1 , newGuy ) ; } else { markerSequence . add ( 0 , newGuy ) ; } }
insert the given adobemarkersegment into the marker sequence , as follows ( we assume there is no adobe segment yet ) : if there is a jfif segment , then the new adobe segment is inserted after it . if there is no jfif segment , the new adobe segment is inserted after the last unknown segment , if there are any . if there are no unknown segments , the new adobe segment is inserted at the beginning of the sequence .
