Here you can find the source of toPrimitiveLongArray(Collection
public static long[] toPrimitiveLongArray(Collection<Long> collection)
//package com.java2s; import java.util.Collection; public class Main { public static long[] toPrimitiveLongArray(Collection<Long> collection) { // Need to do this manually because we're converting to a primitive long array, not // a Long array. final int size = collection.size(); final long[] ret = new long[size]; // Collection doesn't have get(i). (Iterable doesn't have size()) int i = 0; for (Long value : collection) { ret[i++] = value;/*from ww w .ja va 2s. c om*/ } return ret; } }