code: public static Map<String, Object> parseCommandLineArguments(String[] args, boolean parseNumbers) {
      Map<String, Object> result = new HashMap<String, Object>();
      for (int i = 0; i < args.length; i++) {
        String key = args[i];
        if (key.charAt(0) == '-') {
          if (i + 1 < args.length) {
            String value = args[i + 1];
            if (value.charAt(0) != '-') {
              if (parseNumbers) {
                Object numericValue = value;
                try {
                  numericValue = Double.parseDouble(value);
                } catch (NumberFormatException e2) {
                  // ignore
                }
                result.put(key, numericValue);
              } else {
                result.put(key, value);
              }
              i++;
            } else {
              result.put(key, null);
            }
          } else {
            result.put(key, null);
          }
        }
      }
      return result;
    }
docs: A simpler form of command line argument parsing.
  Dan thinks this is highly superior to the overly complexified code that
  comes before it.
  Parses command line arguments into a Map. Arguments of the form
  -flag1 arg1 -flag2 -flag3 arg3
  will be parsed so that the flag is a key in the Map (including the hyphen)
  and the
  optional argument will be its value (if present).
  In this version, if the argument is numeric, it will be a Double value
  in the map, not a String.
  
  @return A Map from keys to possible values (String or null)