app/src/main/java/com/example/dannyboy/smartguitarapp/DebugLog.java
private static String formatMessage(Integer id,String message){
		boolean firstLine=true;
		int lineLength=40;
		int totalLines=(int)Math.ceil(message.length()/((float)lineLength));

		StringBuilder builder = new StringBuilder();
		for(int line=0; line<totalLines; line++){
			String currentLine="";
			int posStart=line*lineLength;
			int posEnd=(line+1)*lineLength;
			if (posEnd>message.length()){
				posEnd=message.length();
			}
			if (firstLine) {
				currentLine=String.format("%3d %s\n",id,message.substring(posStart,posEnd));
				firstLine=false;
			}
			else {
				currentLine=String.format("    %s\n",message.substring(posStart,posEnd));
			}
			builder.append(currentLine);
		}
		return builder.toString();
	}
/**
	 * Used internaly to format all the messages as a numbered list where each message is numbered according to order of creation.
	 * @param id message id (i.e. serial number)
	 * @param message actual message
	 */
Used internaly to format all the messages as a numbered list where each message is numbered according to order of creation.
Used internaly to format all the messages as a numbered list where each message is numbered according to order of creation .
private static String formatMessage(Integer id,String message){
		boolean firstLine=true;
		int lineLength=40;
		int totalLines=(int)Math.ceil(message.length()/((float)lineLength));
		StringBuilder builder = new StringBuilder();
		for(int line=0; line<totalLines; line++){
			String currentLine="";
			int posStart=line*lineLength;
			int posEnd=(line+1)*lineLength;
			if (posEnd>message.length()){
				posEnd=message.length();
			}
			if (firstLine) {
				currentLine=String.format("%3d %s\n",id,message.substring(posStart,posEnd));
				firstLine=false;
			}
			else {
				currentLine=String.format("    %s\n",message.substring(posStart,posEnd));
			}
			builder.append(currentLine);
		}
		return builder.toString();
	}
private static String formatMessage ( Integer id , String message ) { boolean firstLine = true ; int lineLength = 40 ; int totalLines = ( int ) Math . ceil ( message . length ( ) / ( ( float ) lineLength ) ) ; StringBuilder builder = new StringBuilder ( ) ; for ( int line = 0 ; line < totalLines ; line ++ ) { String currentLine = "" ; int posStart = line * lineLength ; int posEnd = ( line + 1 ) * lineLength ; if ( posEnd > message . length ( ) ) { posEnd = message . length ( ) ; } if ( firstLine ) { currentLine = String . format ( "%3d %s\n" , id , message . substring ( posStart , posEnd ) ) ; firstLine = false ; } else { currentLine = String . format ( "    %s\n" , message . substring ( posStart , posEnd ) ) ; } builder . append ( currentLine ) ; } return builder . toString ( ) ; }
Used internaly to format all the messages as a numbered list where each message is numbered according to order of creation.
Used internaly to format all the messages as a numbered list where each message is numbered according to order of creation .