title: Converting String[] args. to int/double in java?
body: <p>I'm trying to convert a main programs "String[] args" into 5 ints, and 4 doubles. (i know it's kind of confusing)</p>
  
  <p>The way i was thinking of doing it was having a forreach loop to loop through String args[] and add them to an int array (for the first 5), however i had to use  for the array, so it doesn't work.</p>
  
  <pre><code>if (args != null) {
          // If arguments where given, use the arguments and run the program
          // NEED TO SOMEHOW CONVERT ARGS INTO INTEGER FORM AFTER BEING PASSED IN
          ArrayList&lt;Integer&gt; valArr = new ArrayList&lt;Integer&gt;(10); // could be 9
          for (String val : args) {
              // Parse the string and add it to valArray
              int temp = Integer.parseInt(val);
              valArr.add(temp);
          }   
  
          CarPark cp = new CarPark(valArr[0], valArr[1], valArr[2], valArr[3]);   
  </code></pre>
  
  <p>this is what i'm looking at at the moment... am i completely wrong? or close?</p>