Why do I get 0 every time i call the array from a class?
<p>Here is what i'm supposed to do:</p>

<blockquote>
  <p>Write a class with a constructor that accepts a file names as its argument.
  Assume the file constain a series of numbers, each written on a separate line. The class should read the contents of the file file into an array, and then displays the following date:</p>
  
  <ul>
  <li>The lowest number in the array</li>
  <li>The highest number in the array</li>
  <li>The total of the numbers in the array</li>
  <li>The average of the numbers in the array</li>
  <li>The content of the array.</li>
  </ul>
</blockquote>

<p>every time I run  the program I get the amount of numbers in the array, as 0 and the other outputs as well.</p>

<p>here is the worker <code>NumberAnalisis</code> class:</p>

<pre><code>package chapter7;

import java.io.*;
import java.util.Scanner;

public class NumberAnalisis {

    private int[] array;

    /**
     * Constructor.
     * @throws IOException 
     */

    public NumberAnalisis(String name) throws IOException{

        File file = new File(name);
        Scanner inputFile = new Scanner(file);

        int count =0;   //To count the amount of numbers 
                       //in the file.

        int index = 0;  //Index for an array.

        int number;

        //Determine the amount of numbers in a file.
        while(inputFile.hasNext()){
            inputFile.nextInt();
            count++;
        }

        //Create an array as big as the amount of numbers 
        //in the file.
        array = new int[count];

        //Store the content of the file into the array.
        while(inputFile.hasNext() &amp;&amp; index&lt;array.length){
            number = inputFile.nextInt();
            array[index] = number;
            index++;
        }
        inputFile.close();  //Close the file.
    }

    /**
     * The getHigh method 
     * @return the highest number
     * in the file.
     */

    public int getHigh(){

        int high;

        high = array[0];

        for(int index =1; index&lt;array.length; index++){
            if(array[index]&gt;high){
                high = array[index];
            }
        }

        return high;
    }

    /**
     * The getLow method
     * @return The lowest number
     * in the file.
     */

    public int getLow(){
        int low;

        low = array[0];

        for(int index =1; index&lt;array.length; index++){

            if(array[index]&lt;low){
                low = array[index];
            }
        }

        return low;
    }


    /**
     * The total method
     * @return return the
     * total in the file.
     */

    public int total(){
        int total =0;

        for(int index =0; index&lt;array.length; index++){
            total += array[index];
        }
        return total;
    }

    /**
     * The average method
     * @return The average
     * of the numbers in 
     * the file.
     */

    public double average(){

        double average =0;

        for(int index =0; index&lt;array.length; index++){
            average += array[index];
        }

        return average/array.length;
    }

    /**
     * The getFile method 
     * @return the content 
     * of the file.
     */

    public int[] getFile(){
        return array;
    }
}//End of class.
</code></pre>

<p>Here is the <code>main</code> class:</p>

<pre><code>package chapter7;

import java.io.*;
import java.util.Scanner;

public class NumberAnalisisTest {

    public static void main(String[]args)throws IOException{
        String name;

         name = createFile();
         display(name);

    }//End of main.

    /**
     * The createFile method prompt the user
     * to create a file and store numbers.
     * @throws IOException
     */

    public static String createFile()throws IOException{

        String name;    //Name to hold the file.

        int numbers =0; //To hold the number going into 
                     //the file.

        Scanner keyboard = new Scanner(System.in);

        System.out.println("Enter the name to create a file");
        name = keyboard.nextLine();

        //Create a file.
        PrintWriter outputFile = new PrintWriter(name + ".txt");

        System.out.println("Let's start adding numbers to the file\n");

        //Store numbers into the file.
        while(!(numbers==-1)){
            System.out.println("Enter a number" + "\nto quit press -1");
            numbers = keyboard.nextInt();
            if(!(numbers==-1)){
                outputFile.println(numbers);
            }
        }
        outputFile.close();
        keyboard.close();
        return name;
    }

    /**
     * The display method displays
     * content of the file,
     * the lowest number in the file
     * the highest, the total and the
     * average.
     * @throws IOException 
     */

    public static void display(String fileName) throws IOException{

        NumberAnalisis  number = new NumberAnalisis(fileName + ".txt");

        System.out.println("The content of the file is the following");

        //Display the content of the file.
        for(int index = 0; index&lt;number.getFile().length; index++){
            System.out.println(number.getFile()[index]);
        }

        System.out.println("The highest number in the file is " 
                        + number.getHigh() + "\nThe Lowest is "
                        + number.getLow() + "\nThe average is "
                        + number.average());
    }
}//End of class.
</code></pre>