java_gen: use Arrays.copyOf() instead of .clone() for defensive copy

@gregor-bsn convinced me it's better :)