Hey guys I have to create a program that computes the mean, standard deviation, and finds the max and min of a group of numbers read in from a file. I'm having trouble storing the objects from the file in an array and then reading it to compute the mean. Here's what I have so far:

import java.io.*; import java.util.*; public class Assignment5 { public static void main(String[] args) throws FileNotFoundException { Scanner input = new Scanner(new File("nerd.txt")); double[] data = new double[1000]; double mean = 0; double sum = 0; double n = 0; while (input.hasNextDouble()){ double element = input.nextDouble(); data[element]++; n++; } for(int x = 0; x < data.length; x++){ sum = sum + data[x] * x; } mean = (double)sum / n; System.out.println("The mean is " + mean); } }

I don't really understand arrays. But basically I have to: Use an array to store the numbers being read. Keep a count each time a number is read (this will be N).

I just really don't know how to store the numbers from the file :/. Any help will be greatly appreciated