code: public static String printLine(String... values) {
          // set up a CSVUtils
          StringWriter stringWriter = new StringWriter();
          CSVPrinter csvPrinter = new CSVPrinter(stringWriter);
  
          // check for null values an "null" as strings and convert them
          // into the strings "null" and "\"null\""
          for (int i = 0; i < values.length; i++) {
              if (values[i] == null) {
                  values[i] = "null";
              } else if (values[i].equals("null")) {
                  values[i] = "\"null\"";
              }
          }
  
          // convert to CSV
          csvPrinter.println(values);
  
          // as the resulting string has \r\n at the end, we will trim that away
          return stringWriter.toString().trim();
      }
docs: Converts an array of string values into a single CSV line. All
  <code>null</code> values are converted to the string <code>"null"</code>,
  all strings equal to <code>"null"</code> will additionally get quotes
  around.
  
  @param values the value array
  @return the CSV string, will be an empty string if the length of the
  value array is 0