Changed Arrays.copyOf to System.arraycopy