What I am trying to do is make a program that reads a txt file and converts the number into a double array.
import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class rocket {
public static void main(String[] args) throws IOException, FileNotFoundException
{
System.out.println(readLines("/Users/Jeremy/Documents/workspace/altitude.txt"));
}
public static Double[] readLines(String filename) throws IOException {
FileReader fileReader = new FileReader(filename);
BufferedReader bufferedReader = new BufferedReader(fileReader);
List<Double> lines = new ArrayList<Double>();
String line = null;
while ((line = bufferedReader.readLine()) != null) {
lines.add(Double.parseDouble(line));
}
bufferedReader.close();
return lines.toArray(new Double[lines.size()]);
}
}
This is my code, but when I run it I get [Ljava.lang.Double;@35960f05
A little info about my txt file, each number is on a seperateline and there is 26 numbers