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.
private long[] toArray(List<Long> values) {
long[] result = new long[values.size()];
int i = 0;
for (Long l : values)
result[i++] = l;
return result;
}