I wanted to have more presicion than just using Math.PI, but i can't figure out how to do it (partially). Someone else hepled me get started, but their code didn't work entirely, as I just keep getting the same two numbers. This si what I have:

Code:
package piApplet;

public class piApplet
{
  public static void main(String[] args)
  {
    long factorial = 1;
    int i = 1;
    double errMax = 1E-8, piOld = 1.0, piNew = 1.0, error = 1.0;

    while (error > errMax)
    {
      factorial = factorial * i;
      piNew = piOld + (1.0 / (double)factorial) * Math.pow(-1, i);
      error = Math.abs(piNew - piOld);
      i++;
      piOld = piNew;
      System.out.println(piOld);
    }

    System.out.println("pi = " +piNew);
  }
}
Can anyone help?