private static void generateGroups(final GeneratorAdapter generator, final int[][] groups, final Method setGroupsMethod) {
    if (groups.length == 0) return;
    int groupLocal = generator.newLocal(Type.getType("[I"));
    generator.dup();   // duplicate FormLayout reference
    generator.push(groups.length);
    generator.newArray(Type.getType("[I"));
    for(int i=0; i<groups.length; i++) {
      generator.dup();
      generator.push(groups [i].length);
      generator.newArray(Type.INT_TYPE);
      generator.storeLocal(groupLocal);
      for(int j=0; j<groups [i].length; j++) {
        generator.loadLocal(groupLocal);
        generator.push(j);
        generator.push(groups [i][j]);
        generator.visitInsn(Opcodes.IASTORE);
      }
      generator.push(i);
      generator.loadLocal(groupLocal);
      generator.visitInsn(Opcodes.AASTORE);
    }
    generator.invokeVirtual(ourFormLayoutType, setGroupsMethod);
  }
private static void generateGroups(final GeneratorAdapter generator, final int[][] groups, final Method setGroupsMethod)