I have a text file with a list of doubles. The first value of the line is the x value and the second value is the y value.
103.0 274.0
133.0 383.0
342.0 250.0
204.0 126.0
177.0 357.0
...
How can I read these values and load them into an array list?
ArrayList<Point> store = new ArrayList<Point>();
File file = fc.getSelectedFile();
StringBuilder all = new StringBuilder();
BufferedReader reader = new BufferedReader( new FileReader(file));
String input = null;
while ((input = reader.readLine()) != null)
{
String a = all.append(input+"\n").toString();
String[] hold = a.split(" ");
double x = Double.parseDouble(hold[0]);
int aa = (int)(x);
double y = Double.parseDouble(hold[1]);
int bb = (int)(y);
store.add(new Point(aa, bb));
}