question: protected static int makeMarkAndDotEqual ( JTextArea textArea , boolean forward ) { Caret c = textArea . getCaret ( ) ; int val = forward ? Math . min ( c . getDot ( ) , c . getMark ( ) ) : Math . max ( c . getDot ( ) , c . getMark ( ) ) ; c . setDot ( val ) ; return val ; }
target:  Makes the caret's dot and mark the same location so that, for the next search in the specified direction, a match will be found even if it was within the original dot and mark's selection.