```
public class GenerateAllStrings {

    int []arrA;

    public GenerateAllStrings(int n)
    {
        arrA = new int[n];
    }

    public void nBits(int n)
    {
        if(n <= 0)
            System.out.println(Arrays.toString(arrA));
        else
        {
            arrA[n-1] = 0;
            nBits(n-1);
            arrA[n-1] = 1;
            nBits(n-1);
        }
    }

    public static void main(String[] args) throws java.lang.Exception
    {
        int n = 3;
        GenerateAllStrings i = new GenerateAllStrings(n);
        i.nBits(n);
    }

}

```

I am unable to understand recursion in this program. why is n set to 1 after printing the first set of value( I thought it should be zero)? Please explain.