Write a recursive function that takes a positive integer n and plots an N-by-N Hadamard pattern where N = 2^n This is web exercise 2.3.20. from the book Computer Science An Interdisciplinary Approach by Sedgewick &amp; Wayne:

Write a recursive program  that takes a command-line argument n and
plots an N-by-N Hadamard pattern where N = 2^n. Do not use an array. A
1-by-1 Hadamard pattern is a single black square. In general a
2N-by-2N Hadamard pattern is obtained by aligning 4 copies of the
N-by-N pattern in the form of a 2-by-2 grid, and then inverting the
colors of all the squares in the lower right N-by-N copy. The N-by-N
Hadamard H(N) matrix is a boolean matrix with the remarkable property
that any two rows differ in exactly N/2 bits. Here are the first few
Hadamard matrices.


Here is my program:
public class wexercise2_3_20 
{
    public static void hadamard(int n, double x, double y, double size,
                                boolean color)
    {
        double x1 = x - size/2, x2 = x + size/2;
        double y1 = y - size/2, y2 = y + size/2;
        if (n == 0) return;
        if (color) 
        {
            StdDraw.setPenColor(StdDraw.BLACK);
            StdDraw.filledSquare(x,y,size);
        }
        else
        {
            StdDraw.setPenColor(StdDraw.WHITE);
            StdDraw.filledSquare(x,y,size);
        }
        hadamard(n-1, x1, y1, size/2, color);
        hadamard(n-1, x1, y2, size/2, color);
        hadamard(n-1, x2, y2, size/2, color);
        hadamard(n-1, x2, y1, size/2, !color);

    }
    public static void main(String[] args)
    {
        int n = Integer.parseInt(args[0]);
        hadamard(n, 0.5, 0.5, 0.5, true);
    }
}

StdDraw is a simple API written by the authors of the book.
Is there any way that I can improve my program?
Thanks for your attention.
Class names in Java should start with a capital letter.
Avoid initializing two variables in the same line.
The filledSquare call is the same in the two if branches, it could be moved out of the if.  Now the two if branches only change in the argument to the setPenColor call, and you could replace it by
Color theColor = color ? WHITE : BLACK;

Now it seems like you could drop the boolean argument altogether (boolean arguments suck) and pass a Color; all you need is a function that inverts the color.
This criticism has nothing to do with recursion; I have no idea if this works correctly or not :)