code: public static String[] sanitizeHeaders(String[] headers, String regex, String replace) {
  		String result[] = new String[headers.length];
  		 HashMap<String,Integer> headerHashMap = new HashMap<>(); // for detecting duplicates
  		for (int i=0;i<headers.length;i++) {
  			String currentColumn=headers[i];
  			// if column name is empty create artificial column name
  			if ((currentColumn==null) || "".equals(currentColumn)) {
  				currentColumn= HadoopOfficeReadConfiguration.PREFIX_UNKNOWN_COL+i;
  				
  			} 				 
  			// apply regex to column name
  			if ((regex!=null) && (!"".equals(regex))) {
  				currentColumn=currentColumn.replaceAll(regex, replace);
  			}
  			// check if column name already exist
  			Integer existingEntry = headerHashMap.get(currentColumn);
  			if (existingEntry==null) {
  				 existingEntry = 1;
  				 
  			 } else {
  				 existingEntry+=1;
  				 currentColumn+=existingEntry;
  			 }
  			result[i]=currentColumn;
  			headerHashMap.put(currentColumn, existingEntry);
  		}
  		return result;
  	}
docs: Sanitize headers
  1) Replace empty/null column names by "Col" + column number
  2) Replace duplicate column names by column name + increasing number
  3) Replace column names based on regular expressions with another string (useful in case your Big Data platform does not support certain characters in the column String)
  
  
  @param headers original headers to sanitize
  @param regex regex to be searched in each column name (all occurrences, see String.replaceAll)
  @param replace String to replace the matched regular expression
  @return sanitized headers