title: How to copy a subset from an array of strings to an array of ints using Groovy?
body: <p>I have a String array in a Groovy class (args to a main method):</p>
  
  <pre><code>String[] args
  </code></pre>
  
  <p>I'd like to convert the 3rd to the last element into a new array of ints.  Is there an easier way to do this in Groovy other than:</p>
  
  <pre><code>final int numInts = args.length - 2
  final int [] intArray = new int[numInts]
  for (int i = 2; i &lt; args.length; i++) {
      intArray[i-2]=Integer.parseInt(args[i])
  }
  </code></pre>
  
  <p>I wanted to do:</p>
  
  <pre><code>final int numInts = args.length - 2
  final int [] intArray = new int[numInts]
  System.arraycopy(args, 2, intArray, 0, numInts)
  </code></pre>
  
  <p>But it throws a class cast exception.</p>
  
  <p>Thanks!</p>