src/main/java/com/github/ricksbrown/cowsay/Bubble.java
private static String formatBubble(final BubbleWrap bubble, final String message, final int longestLine) {
		String newLine = System.getProperty("line.separator");
		String[] lines = message.split(newLine);
		StringBuilder sb = new StringBuilder();
		sb.append(bubble.buildTop(longestLine));
		if (lines.length > 1) {
			sb.append(bubble.formatMultiOpen(lines[0], longestLine));
			for (int i = 1; i < (lines.length - 1); i++) {
				sb.append(bubble.formatMultiMid(lines[i], longestLine));
			}
			sb.append(bubble.formatMultiEnd(lines[(lines.length - 1)], longestLine));
		} else {
			sb.append(bubble.formatSingle(lines[0]));
		}
		sb.append(bubble.buildBottom(longestLine));
		return sb.toString();
	}
private static String formatBubble(final BubbleWrap bubble, final String message, final int longestLine) {
		String newLine = System.getProperty("line.separator");
		String[] lines = message.split(newLine);
		StringBuilder sb = new StringBuilder();
		sb.append(bubble.buildTop(longestLine));
		if (lines.length > 1) {
			sb.append(bubble.formatMultiOpen(lines[0], longestLine));
			for (int i = 1; i < (lines.length - 1); i++) {
				sb.append(bubble.formatMultiMid(lines[i], longestLine));
			}
			sb.append(bubble.formatMultiEnd(lines[(lines.length - 1)], longestLine));
		} else {
			sb.append(bubble.formatSingle(lines[0]));
		}
		sb.append(bubble.buildBottom(longestLine));
		return sb.toString();
	}
private static String formatBubble ( final BubbleWrap bubble , final String message , final int longestLine ) { String newLine = System . getProperty ( "line.separator" ) ; String [ ] lines = message . split ( newLine ) ; StringBuilder sb = new StringBuilder ( ) ; sb . append ( bubble . buildTop ( longestLine ) ) ; if ( lines . length > 1 ) { sb . append ( bubble . formatMultiOpen ( lines [ 0 ] , longestLine ) ) ; for ( int i = 1 ; i < ( lines . length - 1 ) ; i ++ ) { sb . append ( bubble . formatMultiMid ( lines [ i ] , longestLine ) ) ; } sb . append ( bubble . formatMultiEnd ( lines [ ( lines . length - 1 ) ] , longestLine ) ) ; } else { sb . append ( bubble . formatSingle ( lines [ 0 ] ) ) ; } sb . append ( bubble . buildBottom ( longestLine ) ) ; return sb . toString ( ) ; }
Draws a complete bubble around a line-wrapped message.
@param bubble The BubbleWrap to use (e.g. SPEECH_BUBBLE or THOUGHT_BUBBLE)
@param message The message to wrap, it should already be line-wrapped if appropriate.
@param longestLine The length of the longest line in the message.
@return The message, wrapped in a bubble.
Draws a complete bubble around a line - wrapped message .