Here you can find the source of subset(double[] vals, boolean[] select)
public static double[] subset(double[] vals, boolean[] select)
//package com.java2s; //License from project: LGPL import java.util.*; public class Main { public static double[] subset(double[] vals, boolean[] select) { assert vals.length == select.length; List<Double> list = new ArrayList<Double>(); for (int i = 0; i < vals.length; i++) { if (select[i] && !Double.isNaN(vals[i])) list.add(vals[i]);//from w w w . ja v a 2 s . c o m } double[] sub = new double[list.size()]; int i = 0; for (Double val : list) { sub[i++] = val; } return sub; } }