Loop stops running java
<p>For the code below, it stops running when "n" gets around 100,000. I need it to run until 1 million. I dont know where its going wrong, I am still learning Java so there might be simple mistakes in the code as well. </p>

<pre><code> public class Problem14{
public static void main(String[] args) {
    int chainLength;
    int longestChain = 0;
    int startingNumber = 0;
    for(int n =2; n&lt;=1000000; n++)
    {
        chainLength = getChain(n);
        if(chainLength &gt; longestChain)
        {
            System.out.println("chainLength: "+chainLength+" start: "+n);
            longestChain = chainLength;
            startingNumber = n;
        }
    }

    System.out.println("longest:"+longestChain +" "+"start:"+startingNumber);
}
public static int getChain(int y)
{
    int count = 0;
    while(y != 1)
    {
        if((y%2) == 0)
        {
            y = y/2;
        }
        else{
            y = (3*y) + 1;
        }
        count = count + 1;
    }

    return count;   
}
}
</code></pre>
