replaced use of Arrays.copyOf for Java 1.5 compatibility