question: public static TextWithMnemonic parseText ( final String textWithMnemonic ) { if ( textWithMnemonic == null ) { throw new IllegalArgumentException ( "textWithMnemonic cannot be null" ) ; } int index = - 1 ; final StringBuffer plainText = new StringBuffer ( ) ; for ( int i = 0 ; i < textWithMnemonic . length ( ) ; i ++ ) { char ch = textWithMnemonic . charAt ( i ) ; if ( ch == '&' ) { i ++ ; if ( i >= textWithMnemonic . length ( ) ) { break ; } ch = textWithMnemonic . charAt ( i ) ; if ( ch != '&' ) { index = plainText . length ( ) ; } } plainText . append ( ch ) ; } return new TextWithMnemonic ( plainText . toString ( ) , index ) ; }
target:  Parses text that might contain mnemonic and returns structure which contains plain text and index of mnemonic char (if any)