$$$APPLET
public void Calculate(int MaxIter, int width, int height) { final double MINX = -2; // Bounds final double MINY = -2; final double MAXX = 2; final double MAXY = 2; double zx, zy, zx2, zy2; // complex variables Z and Z^2 double cx=CX; // complex constant C double cy=CY; // complex constant C int x, y; // x and y co-ordinates int iter; // iteration counter double zx0, zy0, temp; zy0 = MINY; for (y = 0; y < height; y++) { // for y zx0 = MINX; for (x = 0; x < width; x++) { // for x zx = zx0; zy = zy0; for (iter=0; iter < MaxIter; iter++) { // calculate iter zx2 = zx*zx; zy2 = zy*zy; if (zx2 + zy2 > 4.0) break; zy = 2.0*zx*zy+cy; zx = zx2-zy2+cx; } //Calculate Color of pixel from iter - example setColor(new Color((iter/(float)MaxIter) ,(iter/(float)MaxIter) ,(float)0.77)); drawLine(x,y,x,y); zx0 += (MAXX-MINX)/width; } // end for x zy0 += (MAXY-MINY)/height; } //end for y }