Here you can find the source of toLongs(Long[] values)
public static long[] toLongs(Long[] values)
//package com.java2s; //License from project: Open Source License public class Main { public static final long DEFAULT_LONG = 0L; public static long[] toLongs(Long[] values) { return toLongs(values, DEFAULT_LONG); }/* w ww . j av a 2s .c om*/ public static long[] toLongs(Long[] values, long defaultValue) { long[] results = new long[0]; if (values != null) { results = new long[values.length]; for (int i = 0; i < results.length; i++) { Long element = values[i]; try { results[i] = (element != null ? element.longValue() : defaultValue); } catch (Exception ex) { // ex.printStackTrace(); } } } return results; } public static Long[] toLongs(long[] values) { return toLongs(values, DEFAULT_LONG); } public static Long[] toLongs(long[] values, long defaultValue) { Long[] results = new Long[0]; if (values != null) { results = new Long[values.length]; for (int i = 0; i < results.length; i++) { long element = values[i]; try { results[i] = new Long(element); } catch (Exception ex) { results[i] = defaultValue; // ex.printStackTrace(); } } } return results; } }