public static String wrapText(String text, int maxCharsPerLine){
		String[] strArray = preprocess(text,maxCharsPerLine);
		String result = "";
		int linelength = 0;
		/*if(strArray[0].length() > maxCharsPerLine){
			result = result + overSize(strArray[0],maxCharsPerLine)[0];
			linelength = Integer.parseInt(overSize(strArray[0],maxCharsPerLine)[1]) + 1;
		} else {*/
			result = strArray[0];
			linelength = strArray[0].length()+1;
		//}
		for(int i = 1; i < strArray.length; i++){
			if(linelength == 0){
				linelength = linelength + strArray[i].length() + 1;
				result = result + strArray[i];
			} else if(strArray[i].length()+linelength < maxCharsPerLine){
				linelength = linelength + strArray[i].length() + 1;
				result = result +" "+ strArray[i];
			} else /*if(strArray[i].length() > maxCharsPerLine) {
				result = result + overSize(strArray[i],maxCharsPerLine)[0];
				linelength = Integer.parseInt(overSize(strArray[i],maxCharsPerLine)[1]) + 1;
			} else */if(strArray[i].length()+linelength > maxCharsPerLine){
				linelength = strArray[i].length() +1;
				result = result +"\n"+ strArray[i];
			} else if(strArray[i].length()+linelength == maxCharsPerLine){
				linelength = 0;
				result = result +" "+ strArray[i]+"\n";
			} 
		}
		return result;
	}