I want to copy the old array to the new one and I want to add the empty elements to the new array
import java.util.Arrays;
public class testArray2D {
    public static void main(String[] args) {
        int[][] a = {{1, 2, 3}};
        // make a one bigger
        int add = 3;
        a = Arrays.copyOf(a, a.length + add);
        for (int i = 1; i < a.length; i++) {
            for (int j = 0; j < a[i].length; j++) {
                a[i][j] = 1;
            }
        }
        for (int i[] : a) {
            System.out.println(Arrays.toString(i));
        }
    }
}
The expected output is
1 2 3
1 1 1 
1 1 1
1 1 1
Why I can't run this?
 
     
     
    