private static String removeSubTrailers(String decodedSubject){
  int subStringStart=0;
  int subStringEnd=decodedSubject.length();
  int originalSize=decodedSubject.length();
  int curPos=originalSize - 1;
  while (true) {
    char c=decodedSubject.charAt(curPos--);
    if (c == WS) {
      subStringEnd--;
    }
 else {
      if (subStringEnd > FWD_PARENS.length() && decodedSubject.endsWith(FWD_PARENS)) {
        subStringEnd-=FWD_PARENS.length();
      }
      break;
    }
  }
  decodedSubject=decodedSubject.substring(subStringStart,subStringEnd);
  return decodedSubject;
}

private static String removeSubTrailers ( String decodedSubject ) { int subStringStart = 0 ; int subStringEnd = decodedSubject . length ( ) ; int originalSize = decodedSubject . length ( ) ; int curPos = originalSize - 1 ; while ( true ) { char c = decodedSubject . charAt ( curPos -- ) ; if ( c == WS ) { subStringEnd -- ; } else { if ( subStringEnd > FWD_PARENS . length ( ) && decodedSubject . endsWith ( FWD_PARENS ) ) { subStringEnd -= FWD_PARENS . length ( ) ; } break ; } } decodedSubject = decodedSubject . substring ( subStringStart , subStringEnd ) ; return decodedSubject ; }
remove the remove_subj_trailers subj - trailer = " ( fwd ) " / wsp
