Here you can find the source of read(byte[] input, int size)
public static double[][] read(byte[] input, int size) throws IOException, ParseException
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.text.ParseException; public class Main { private static final String DOT = "."; private static final String COMMA = ","; public static double[][] read(byte[] input, int size) throws IOException, ParseException { try (ByteArrayInputStream inputStream = new ByteArrayInputStream(input)) { return read(inputStream, size); }/*from w w w . j a va2s. co m*/ } public static double[][] read(InputStream inputStream, int size) throws IOException, ParseException { try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream))) { double[][] result = new double[size][]; int row = 0; String line; while ((line = bufferedReader.readLine()) != null) { String[] strings = line.trim().split("\\s+"); double[] values = new double[strings.length]; for (int i = 0; i < strings.length; i++) { values[i] = Double.valueOf(strings[i].replace(COMMA, DOT)); } result[row++] = values; } return result; } } }