How do i get this array to end?
<p>Hey, so i have this hw assignment and i have to write a program that allows the user to input students names and grades and give back the higest lowest and average. The only problem is there is a max 50 students in the class(or so the sheet says) and there are only 10 students names and grades on it. How do i get the array to end after the last student?</p>

<pre><code>static final int MAX = 50;
public static void main(String[] args)
{
    int index, average;
    int highest = 0, student = 1;
    Scanner keyboard = new Scanner(System.in);
    String [] students = new String[MAX];
    int[] grades = new int[MAX];

    System.out.println("Please enter the name of the student and their test grade");
    System.out.print("Students: ");
    for(index=0; index&lt;MAX; index++)
        {
            students[index] = keyboard.nextLine();
            student = student + index;
            if(students[index]=="Done"))
            {
                student = student - 1;
                continue;
            }

        }
    System.out.print("Grades: ");
    for(index=0; index&lt;student; index++)
        grades[index] = keyboard.nextInt();
    averageMan(grades, student);
    for(index=0; index&lt;student; index++)
        if(grades[index] &lt; averageMan(grades, student))
            System.out.println(students[index] + " Your test grade was " +
                            "below the class average. Step it up.");
    for(index=0; index&lt;student; index++)
        if(grades[index] &gt; highest)
            highest = grades[index];
    System.out.println("The highest test grade in the class goes to " +
                    students[highest] + " with a grade of " + grades[highest]);
}

public static int averageMan(int[] g, int s)
{
    int index, sum = 0;
    int averages;
    for(index=0; index&lt;s; index++)
        sum = sum + g[index];
    averages = sum / s;
    return averages;
}
</code></pre>

<p>}</p>
