Here you can find the source of toLongArray(List
public static long[] toLongArray(List<Long> list)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static long[] toLongArray(List<Long> list) { long[] res = new long[list.size()]; int i = 0; for (Iterator<Long> iterator = list.iterator(); iterator.hasNext();) { res[i++] = iterator.next();//from ww w.j av a 2 s. c om } return res; } }