Just trying to declare and initialize a 2D array using the codemodel library by Sun but I'm having some issues. I've tried:
JBlock.decl(model.LONG.array().array(), "arrayName", JExpr.newArray(model.LONG, n));
which outputs:
long[][] arrayName = new long[ n ] ;
But I can't seem to find a way to fill in the last [ ]. I've tried several variations.
To be more specific, I need to be able to initialize with something like:
(int) Math.sqrt(array.length);
JExpr.ref() doesn't seem to work for this.
Any help would be appreciated. Thanks