Here you can find the source of avgIgnoreNaN(double[] values)
public static double avgIgnoreNaN(double[] values)
//package com.java2s; //License from project: Open Source License public class Main { public static double avgIgnoreNaN(double[] values) { double avg = 0; int counter = 0; for (double v : values) { if (!Double.isNaN(v)) { avg += v;/*ww w .j a va 2s . c o m*/ counter++; } } if (counter == 0) { return 0; } return avg / (double) counter; } }