Here you can find the source of toIntArray(double[] a)
public final static int[] toIntArray(double[] a)
//package com.java2s; import java.util.Collection; import java.util.Iterator; public class Main { /**/*from w w w . jav a 2 s . c om*/ * Converts a List of Integer to an int[] * @param list * @return an array of int */ public final static int[] toIntArray(Collection<Integer> list) { int[] res = new int[list.size()]; int index = 0; Iterator<Integer> iter = list.iterator(); while (iter.hasNext()) { Integer i = (Integer) iter.next(); res[index++] = i.intValue(); } return res; } public final static int[] toIntArray(double[] a) { int[] res = new int[a.length]; for (int i = 0; i < a.length; i++) { res[i] = (int) a[i]; } return res; } }