Java tutorial
//package com.java2s; public class Main { public static double[] parseDoubleArrayFromHeader(String lineFromHeader) { lineFromHeader = lineFromHeader.replaceAll(",$", ""); lineFromHeader = lineFromHeader.trim(); String[] splitLine = lineFromHeader.split("\\s*,\\s*"); double[] doubles = new double[splitLine.length]; for (int i = 0; i < doubles.length; i++) { doubles[i] = Double.parseDouble(splitLine[i]); } return doubles; } }