title: What is the best way of converting List<Long> object to long[] array in java?
body: <p>Is there any utility method to convert a list of Numerical types to array of primitive type?
  In other words I am looking for a better solution than this.</p>
  
  <pre><code>private long[] toArray(List&lt;Long&gt; values) {
      long[] result = new long[values.size()];
      int i = 0;
      for (Long l : values)
          result[i++] = l;
      return result;
  }
  </code></pre>