How do i convert Long[] to long[]? For example i know how to convert if it is not array as below.
long ll = (Long)Object[1].longValue()
But how
There are no standard API method for doing that (how would null
-elements be handled?) so you would need to create such a method yourself.
Something like this (will throw NullPointerException
on any object beeing null
):
public static long[] toPrimitives(Long... objects) {
long[] primitives = new long[objects.length];
for (int i = 0; i < objects.length; i++)
primitives[i] = objects[i];
return primitives;
}