title: How to deal with command line arguments in Java
body: <p>Suppose I have a simple program which takes argument input in one of the following forms
  <br>do1 inputLocation outputLocation
  <br>do2 inputLocation outputLocation
  <br>do3 [30 or 60 or 90] inputLocation outputLocation
  <br>do4 [P D or C] inputLocation outputLocation
  <br>do5 [G H I] inputLocation outputLocation</p>
  
  <p>I also have 5 functions with the same names in the program that I need to call. So far I thought of doing it this way (In 'semi pseudocode')</p>
  
  <pre><code>static void main(String[] args)
  {
      if (args.length == 3)
          processTriple(args);
      if (args.length == 4)
          processQuadruple(args);
      throw new UnsupportedOperationException("dasdhklasdha");
  }
  </code></pre>
  
  <p>where the process functions look like this</p>
  
  <pre><code>processDouble(String args[])
  {
      String operation = "args[0]";
      Location input = getInput(args[1]);
      Location output = getInput(args[2]);
      if (operation.equals("do1"))
          do1(input,output);
      if (operation.equals("do2"))
          do2(input,output);
      ... etc
  }
  </code></pre>
  
  <p>The way I'm doing it doesn't seem very extensible. If a function's arguments change, or new functions are added it seems like this would be a pain to maintain.
  What's the "best" way of going about something like this</p>