replaced 'Arrays.copyOfRange()' with 'System.arraycopy' to avoid resulting arrays with padded zeros.