Infinity isn't a number. But, then, neither is 0, so eh?
And by the way, taking the atan of 1 isn't calculating Pi, since the forumla for arctan uses Pi. It's like "calculating" the constant C in a=bC by setting b to 1. You aren't calculating anything. The best way to calculate Pi in Java is Math.PI, I believe.
To actually calculate Pi, it's an infinite formula. You can keep going and it gets more and more accurate the longer you iterate, until you run out of room in your variable (unless you're using java.Math.BigDecimal, then you can go forever).
I believe this is it: