Java tutorial
//package com.java2s; public class Main { /** * <p>Extract decimal values from an array of strings into an array of double.</p> * * <p>Exceptions in the format of the string are trapped and 0 value(s) returned.</p> * * @param src an array of strings, each of which should be a decimal numeric value * @return an array of double */ static public double[] copyStringToDoubleArray(String[] src) { if (src == null) return null; int n = src.length; double[] dst = new double[n]; for (int j = 0; j < n; ++j) { double value = 0; try { value = Double.valueOf(src[j]).doubleValue(); } catch (NumberFormatException e) { } catch (NullPointerException e) { } dst[j] = value; } return dst; } }