In the following Java code:

```
public static void main(String[] args) {
    Integer[] k = new Integer[] {0, 1, 2, 3};

    int m = 0;
    while (m < k.length) {
        for (int i = 0; i < k.length && k[i] != null; i++)
            System.out.print(k[i] + " ");
        System.out.println("");
        k[m++] = null;
    }
}

```

I was trying to get the following output:

```
0 1 2 3
1 2 3
2 3
3

```

However, the inner for-loop is skipped altogether after the first pass, that is, after the 0 1 2 3 output, and it's because the first element was set to null after the first pass, but I don't understand why that matters, can someone please explain? really confused. Thanks in advance. :)