Welcome to the Ranch
You have been given the answer; unlike fields which default to 0, local variables do not have default values and must be
definitely assigned before they can be used.
You should use the
code button, which I have applied retrospectively and you can see how much better the post looks
Unfortunately it highlights the long line (5). You should divide that line into several lines. You should also divide the multiple declaration; it is a lot easier to read if you declare every variable in its own line with its own semicolon. And don’t declare variables which you are not using.
Don’t use Math.pow for small whole numbers. Avoid Math.pow(i, 2) if possible. Write i * i. Much better performance and possibly precision, as long as you don’t suffer an overflow.