Here you can find the source of loadByUsingSplit(String filename)
protected static double[][] loadByUsingSplit(String filename) throws IOException
//package com.java2s; /*-// w ww .j a va 2 s . c o m * Copyright ? 2009 Diamond Light Source Ltd. * * This file is part of GDA. * * GDA is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License version 3 as published by the Free * Software Foundation. * * GDA is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along * with GDA. If not, see <http://www.gnu.org/licenses/>. */ import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.List; import java.util.Vector; public class Main { protected static double[][] loadByUsingSplit(String filename) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader( new FileInputStream(filename))); return getDataFromReaderUsingSplit(br); } protected static double[][] getDataFromReaderUsingSplit(BufferedReader r) throws IOException { try { List<double[]> data = new Vector<double[]>(); String line = null; while ((line = r.readLine()) != null) { String[] tokens = line.split(" "); double[] values = new double[tokens.length]; for (int i = 0; i < tokens.length; i++) { values[i] = Double.parseDouble(tokens[i]); } data.add(values); } return data.toArray(new double[data.size()][]); } finally { try { r.close(); } catch (IOException e) { // ignore } } } }