Q:

Project Euler 25 infinite loop

I'm working on the Project Euler 25. I worked out how to do Fibonacci and I'm using BigInteger. My program seems to be running for an infinite loop (or so I think). Could it be that it is taking a long time or is it actually going into infinite loop? Can someone point me in the correct direction so I can fix it?
import java.math.BigInteger;

public class Problem25 {

    public static void main(String[] args) {
        getTerm(0);
    }

    public static void getTerm(int start) {

        BigInteger var = BigInteger.ZERO;
        BigInteger var2 = BigInteger.valueOf(start);

        int counter = 0;

        while(true) {

            BigInteger temp = var.add(var2);
            var = var2;
            var2 = temp;
            counter++;

            if(var.toString().length() > 1000) {
                System.out.print(counter);
            }
        }           
    }
}

EDIT: Sorry people. I thought, I had break; but thanks for your responses.

A:

You have no condition for terminating the loop:
while(true) { // << always true ;P

    BigInteger temp = var.add(var2);
    var = var2;
    var2 = temp;
    counter++;

    if(var.toString().length() > 1000) {
        System.out.print(counter);
    }
}

So it is an infinite loop. You have two (or even more) options:

Specify in the while(statement) what is the condition to continue with the loop for another round.
Add some break; statement to stop the loop if a certain condition is evaluated as true.

A:

getTerm(0);
Shouldn't this be getTerm(1);?
Also, MByD's answer is right; but this is also a critical problem. Without changing this, your program will never output.

