else if(space)
else if(space && word.length() != 0)
	private String doFormat(String text, int maxLineLength)	{		StringBuffer buf = new StringBuffer();		StringBuffer word = new StringBuffer();		int lineLength = 0;		boolean newline = true;		boolean space = false;		char[] chars = text.toCharArray();		for(int i = 0; i < chars.length; i++)		{			char c = chars[i];			switch(c)			{			case '\n':				if(i == 0 || chars.length - i == 1)				{					if(lineLength + word.length() >= maxLineLength)						buf.append('\n');					else if(space)						buf.append(' ');					buf.append(word);					word.setLength(0);					buf.append('\n');					space = false;					break;				}				else if(newline)				{					if(lineLength + word.length() >= maxLineLength)						buf.append('\n');					else if(space)						buf.append(' ');					buf.append(word);					word.setLength(0);					buf.append("\n\n");					newline = space = false;					lineLength = 0;					break;				}				else					newline = true;			case ' ':				if(lineLength + word.length() >= maxLineLength)				{					buf.append('\n');					lineLength = 0;					newline = true;				}				else if(space)				{					buf.append(' ');					lineLength++;					space = false;				}				else					space = true;				buf.append(word);				lineLength += word.length();				word.setLength(0);				break;			default:				newline = false;				// without this test, we would have spaces				// at the start of lines				if(lineLength != 0)					space = true;				word.append(c);				break;			}		}		if(lineLength + word.length() >= maxLineLength)			buf.append('\n');		else if(space)			buf.append(' ');		buf.append(word);		return buf.toString();	}