Here you can find the source of doubleArray(String data)
public static double[] doubleArray(String data)
//package com.java2s; //License from project: Open Source License public class Main { public static double[] doubleArray(String data) { if (data == null || data.equals("")) return new double[0]; String[] split = data.split(" "); double[] r = new double[split.length]; for (int i = 0; i < r.length; i++) { try { r[i] = Double.parseDouble(split[i]); } catch (NumberFormatException e) { r[i] = 0;//from ww w.j a va 2 s.c o m } } return r; } public static double parseDouble(String s) { if (s != null) { try { return Double.parseDouble(s); } catch (NumberFormatException e) { } // Do nothing } return 0; } }