diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/DDC.java b/src/main/java/com/microsoft/sqlserver/jdbc/DDC.java index 6bf3af9e6..77891c37b 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/DDC.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/DDC.java @@ -439,9 +439,7 @@ private static byte[] convertToBytes(BigDecimal value, } } int offset = numBytes - unscaledBytes.length; - for (int i = offset; i < numBytes; ++i) { - ret[i] = unscaledBytes[i - offset]; - } + System.arraycopy(unscaledBytes, offset - offset, ret, offset, numBytes - offset); return ret; } diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java index 1ba3c62e8..2437a82d0 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java @@ -2503,8 +2503,7 @@ public long[] executeLargeBatch() throws SQLServerException, BatchUpdateExceptio updateCounts = new long[batchCommand.updateCounts.length]; - for (int i = 0; i < batchCommand.updateCounts.length; ++i) - updateCounts[i] = batchCommand.updateCounts[i]; + System.arraycopy(batchCommand.updateCounts, 0, updateCounts, 0, batchCommand.updateCounts.length); // Transform the SQLException into a BatchUpdateException with the update counts. if (null != batchCommand.batchException) { @@ -2571,8 +2570,7 @@ final void doExecutePreparedStatementBatch(PrepStmtBatchExecCmd batchCommand) th // Fill in the parameter values for this batch Parameter paramValues[] = batchParamValues.get(numBatchesPrepared); assert paramValues.length == batchParam.length; - for (int i = 0; i < paramValues.length; i++) - batchParam[i] = paramValues[i]; + System.arraycopy(paramValues, 0, batchParam, 0, paramValues.length); boolean hasExistingTypeDefinitions = preparedTypeDefinitions != null; boolean hasNewTypeDefinitions = buildPreparedStrings(batchParam, false);