code: public static String[] parse(final String line) {
          boolean insideQuote = false;
          final ArrayList<String> result = new ArrayList<>();
          int quoteCount = 0;
          final StringBuilder sb = new StringBuilder();
          for (int i = 0; i < line.length(); i++) {
              final char c = line.charAt(i);
  
              if (c == QUOTE) {
                  insideQuote = !insideQuote;
                  quoteCount++;
              }
  
              if (c == COMMA && !insideQuote) {
                  String value = sb.toString();
                  value = unQuoteUnEscape(value);
                  result.add(value);
                  sb.setLength(0);
                  continue;
              }
  
              sb.append(c);
          }
  
          result.add(sb.toString());
  
          // Validate
          if (quoteCount % 2 != 0) {
              return new String[0];
          }
  
          return result.toArray(new String[result.size()]);
      }
docs: Parse CSV line
  
  @param line
  line containing csv-encoded data
  @return Array of values