Sorry, I misread your post.
Your code for expanding arrays worked.
I believe that there is just a little logic problem here:
Quote:LSystem2D = (String[][]) expand(LSystem2D, LSystem2D[0].length+1);
You're expanding the outer array (LSystem2D) to the size of the inner array (LSystem2D[0]).
So your outer array becomes (size of LSystem2D[0]) 11 + 1 which equals 12. So the code works.
I believe you want to expand the inner array. To do that, you need to specify the array you want to expand.
Code:
LSystem2D[0] = (String[]) expand(LSystem2D[0], LSystem2D[0].length+1);
Take a look at the code below:
Code:
String[][] LSystem2D = new String[7][11];
println(LSystem2D.length); // 7
LSystem2D = (String[][]) expand(LSystem2D, LSystem2D.length + 1);
println(LSystem2D.length); // 8
println(LSystem2D[0].length); // 11
LSystem2D[0] = (String[]) expand(LSystem2D[0], LSystem2D[0].length+1);
println(LSystem2D[0].length); // 12