code: public static String[] tokenize(String args) {
  
      // Split the args string on whitespace boundaries accounting for quoted
      // strings.
      args = args.trim();
      List<String> argList = new ArrayList<>();
      String arg = "";
      char activeQuote = 0;
      for (int ii = 0; ii < args.length(); ii++) {
        char ch = args.charAt(ii);
        if ((ch == '\'') || (ch == '"')) {
          arg += ch;
          ii++;
          while ((ii < args.length()) && (args.charAt(ii) != ch)) {
            arg += args.charAt(ii++);
          }
          arg += ch;
        } else if (Character.isWhitespace(ch)) {
          // System.out.printf ("adding argument '%s'%n", arg);
          argList.add(arg);
          arg = "";
          while ((ii < args.length()) && Character.isWhitespace(args.charAt(ii))) {
            ii++;
          }
          if (ii < args.length()) {
            // Encountered a non-whitespace character.
            // Back up to process it on the next loop iteration.
            ii--;
          }
        } else { // must be part of current argument
          arg += ch;
        }
      }
      if (!arg.equals("")) {
        argList.add(arg);
      }
  
      String[] argsArray = argList.toArray(new String[argList.size()]);
      return argsArray;
    }
docs: TODO: should this throw some exceptions?