private String justify(ArrayList<String> line, int wordLength, int L, boolean lastLine) {
		int empties = line.size() - 1;
		if (empties == 0 || lastLine) {
			String result = "";
			for (int i = 0; i < line.size(); i++) {
				result += line.get(i);
				if (i != line.size() - 1) {
					result += " ";
				}
			}
			for (int i = result.length(); i < L; i++) {
				result += " ";
			}
			return result;
		} else {
			int smallSpace = (L - wordLength) / empties;
			int bigSpaceCount = (L - wordLength) % empties;
			String space = "";
			for (int i = 0; i < smallSpace; i++) {
				space += " ";
			}
			StringBuilder result = new StringBuilder();
			for (int i = 0; i < line.size(); i++) {
				result.append(line.get(i));
				if (i < bigSpaceCount) {
					result.append(" ");
				}
				if (i != line.size() - 1) {
					result.append(space);
				}
			}
			return result.toString();
		}
	}