code: public static String formatSQL(String sql) {
  		if (sql == null || sql.length() == 0)
  			return sql;
  		StringBuilder sb = new StringBuilder();
  		char[] chars = sql.toCharArray();
  		boolean addedSpace = false;
  		for (char c : chars) {
  			if (isInvisibleChar(c)) {
  				if (!addedSpace) {
  					sb.append(" ");
  					addedSpace = true;
  				}
  			} else {
  				sb.append(c);
  				addedSpace = false;
  			}
  		}
  		sb.append(" ");
  		return sb.toString();
  	}
docs: Format all " ", \t, \r... , to " ",