Here you can find the source of loadY(InputStream filePath)
public static double[] loadY(InputStream filePath) throws IOException
//package com.java2s; //License from project: Apache License import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; public class Main { public static double[] loadY(InputStream filePath) throws IOException { String line;//from ww w . j a v a2 s . c om double[] data; List<Double> list = new ArrayList<Double>(); BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(filePath)); while ((line = reader.readLine()) != null) { list.add(Double.parseDouble(line.trim())); } } finally { if (reader != null) reader.close(); } data = new double[list.size()]; for (int i = 0; i < list.size(); i++) data[i] = list.get(i); return data; } public static double[] loadY(String filePath) throws IOException { return loadY(new FileInputStream(filePath)); } }