code: public static String encodeIfNecessary(String text, Usage usage, int usedCharacters) {
  		if (hasToBeEncoded(text, usedCharacters))
  			return encodeEncodedWord(text, usage, usedCharacters);
  		else
  			return text;
  	}
docs: Shortcut method that encodes the specified text into an encoded-word if the
  text has to be encoded.
  
  @param text
  text to encode.
  @param usage
  whether the encoded-word is to be used to replace a text token or
  a word entity (see RFC 822).
  @param usedCharacters
  number of characters already used up (
  <code>0 <= usedCharacters <= 50</code>).
  @return the specified text if encoding is not necessary or an encoded word
  or a sequence of encoded words otherwise.