code: public static boolean hasToBeEncoded(String text, int usedCharacters) {
  		if (text == null)
  			throw new IllegalArgumentException();
  		if (usedCharacters < 0 || usedCharacters > MAX_USED_CHARACTERS)
  			throw new IllegalArgumentException();
  
  		int nonWhiteSpaceCount = usedCharacters;
  
  		for (int idx = 0; idx < text.length(); idx++) {
  			char ch = text.charAt(idx);
  			if (ch == '\t' || ch == ' ') {
  				nonWhiteSpaceCount = 0;
  			} else {
  				nonWhiteSpaceCount++;
  				if (nonWhiteSpaceCount > 77) {
  					// Line cannot be folded into multiple lines with no more
  					// than 78 characters each. Encoding as encoded-words makes
  					// that possible. One character has to be reserved for
  					// folding white space; that leaves 77 characters.
  					return true;
  				}
  
  				if (ch < 32 || ch >= 127) {
  					// non-printable ascii character has to be encoded
  					return true;
  				}
  			}
  		}
  
  		return false;
  	}
docs: Determines if the specified string has to encoded into an encoded-word.
  Returns <code>true</code> if the text contains characters that don't fall
  into the printable ASCII character set or if the text contains a 'word'
  (sequence of non-whitespace characters) longer than 77 characters
  (including characters already used up in the line).
  
  @param text
  text to analyze.
  @param usedCharacters
  number of characters already used up (
  <code>0 <= usedCharacters <= 50</code>).
  @return <code>true</code> if the specified text has to be encoded into an
  encoded-word, <code>false</code> otherwise.