replaced manual array-copy op with System.arraycopy()