FenrirsCode

Untitled

Mar 9th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. public class Stats
  2. {
  3. int sum = 0;
  4. int mean = 0;
  5. double median = 0.0;
  6. double deviation = 0.0;
  7.  
  8.  
  9.  
  10. static public ArrayList<Double> callStats()
  11. {
  12.  
  13. String statFile = "Saved_Draws.txt";:
  14.  
  15. ArrayList<Double> savedStats = new ArrayList<Double>();
  16. try
  17. {
  18.  
  19. FileReader dataReader = new FileReader(statFile);
  20. BufferedReader savedFile = new BufferedReader(dataReader);
  21.  
  22.  
  23. String statsPerLine = savedFile.readLine();
  24.  
  25.  
  26. while (statsPerLine != null)
  27. {
  28. savedStats.add(Double.parseDouble(statsPerLine));
  29. statsPerLine = savedFile.readLine();
  30. }
  31. return savedStats;
  32.  
  33. } catch (FileNotFoundException exp)
  34. {
  35. exp.printStackTrace();
  36. return null;
  37. } catch (IOException exp)
  38. {
  39. return null;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment