The Java file of floats are a line of floats. I want to read one float into a variable that I can send to processing code and process it, then get read he next float process it and read them all one at a time and process it.
Java file of floats:
Java file of floats:
Code:
1319.88 1321.67 1312.22 1320.90 1321.39 1322.04 1322.35 1321.42 1312.34 1321.52 1320.25 1320.98 1320.85 1320.20 1320.63 1321.04 1321.35 1321.81 1322.13 1322.59 1322.16 1321.78 1322.18 1323.23 1322.46 1321.64 1321.31 1320.74 1321.19 1321.77 1322.39 1322.49 1323.21 1323.44 1323.22 1323.18 1323.00 1323.55 1323.65 1322.91 1323.29 1323.35 1322.22 1321.08 1320.79 1321.13 1319.84 1319.81
Code:
import java.io.*;
import java.util.Scanner;
public class ScanXan2 {
public static float main(String[] args) throws IOException {
float CurrentQuote;
try {
CurrentQuote = new Scanner(new BufferedReader(new FileReader("data.java")));
if (CurrentQuote.hasNext()) {
System.out.println("CurrentQuote = " + CurrentQuote.next());
return CurrentQuote;
}
} finally {
if (CurrentQuote == null) {
CurrentQuote.close();
}
}
}
}