Here you can find the source of toLongArray(List
public static long[] toLongArray(List<Long> list)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static long[] toLongArray(List<Long> list) { if (isNullOrEmpty(list)) { return null; }//from w w w .ja v a 2 s . com long[] longs = new long[list.size()]; for (int i = 0; i < longs.length; i++) { longs[i] = list.get(i); } return longs; } public static boolean isNullOrEmpty(Collection c) { return c == null || c.isEmpty(); } public static boolean isNullOrEmpty(String s) { return s == null || s.isEmpty(); } }