lineBuffer.append(whiteSpaceBuffer);
lineBuffer.append(whiteSpaceBuffer.toString());
	private static String formatParagraph(String paragraph, int[] offset, String prefix, String lineDelimiter, int margin) {		LineBreakIterator iterator= new LineBreakIterator(paragraph);		StringBuffer paragraphBuffer= new StringBuffer();		StringBuffer lineBuffer= new StringBuffer();		StringBuffer whiteSpaceBuffer= new StringBuffer();				int index= offset[0];		int indexBuffer= -1;		for (int start= iterator.first(), end= iterator.next(); end != BreakIterator.DONE; start= end, end= iterator.next()) {			String word= paragraph.substring(start, end);			// word is whitespace			if (word.trim().length() == 0) {				whiteSpaceBuffer.append(word);			// first word of line is always appended						} else if (lineBuffer.length() == 0) {				lineBuffer.append(prefix);				lineBuffer.append(whiteSpaceBuffer);				lineBuffer.append(word);			} else {				String line= lineBuffer.toString() + whiteSpaceBuffer.toString()  + word.toString();								// margin exceeded 				if (calculateDisplayedWidth(line) > margin) {					// flush line buffer and wrap paragraph					paragraphBuffer.append(lineBuffer);					paragraphBuffer.append(lineDelimiter);					lineBuffer.setLength(0);					lineBuffer.append(prefix);					lineBuffer.append(word);					// flush index buffer					if (indexBuffer != -1) {						offset[0]= indexBuffer;						// correct for caret in whitespace at the end of line						if (whiteSpaceBuffer.length() != 0 && index < start && index >= start - whiteSpaceBuffer.length())							offset[0] -= (index - (start - whiteSpaceBuffer.length()));						indexBuffer= -1;					}					whiteSpaceBuffer.setLength(0);				// margin not exceeded				} else {					lineBuffer.append(whiteSpaceBuffer);					lineBuffer.append(word);					whiteSpaceBuffer.setLength(0);				}			}			if (index >= start && index < end) {				indexBuffer= paragraphBuffer.length() + lineBuffer.length() + (index - start);				if (word.trim().length() != 0)					indexBuffer -= word.length();			}		}		// flush line buffer				paragraphBuffer.append(lineBuffer);		paragraphBuffer.append(lineDelimiter);		// flush index buffer		if (indexBuffer != -1)				offset[0]= indexBuffer;		// last position is not returned by break iterator		else if (offset[0] == paragraph.length())			offset[0]= paragraphBuffer.length() - lineDelimiter.length();					return paragraphBuffer.toString();	}