You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2025/09/25 12:53:53 UTC
(commons-numbers) 01/16: pmd fix: avoid reassigning parameters
This is an automated email from the ASF dual-hosted git repository.
aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-numbers.git
commit 51007dd6ab9a7746e0c25c74c96944e1693418bd
Author: Alex Herbert <ah...@apache.org>
AuthorDate: Wed Sep 24 16:32:16 2025 +0100
pmd fix: avoid reassigning parameters
---
.../apache/commons/numbers/arrays/MultidimensionalCounter.java | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/commons-numbers-arrays/src/main/java/org/apache/commons/numbers/arrays/MultidimensionalCounter.java b/commons-numbers-arrays/src/main/java/org/apache/commons/numbers/arrays/MultidimensionalCounter.java
index c2c94a80..449e4baa 100644
--- a/commons-numbers-arrays/src/main/java/org/apache/commons/numbers/arrays/MultidimensionalCounter.java
+++ b/commons-numbers-arrays/src/main/java/org/apache/commons/numbers/arrays/MultidimensionalCounter.java
@@ -126,13 +126,14 @@ public final class MultidimensionalCounter {
final int[] indices = new int[dimension];
+ int pos = index;
for (int i = 0; i < last; i++) {
- indices[i] = index / uniCounterOffset[i];
- // index = index % uniCounterOffset[i]
- index = index - indices[i] * uniCounterOffset[i];
+ indices[i] = pos / uniCounterOffset[i];
+ // pos = pos % uniCounterOffset[i]
+ pos = pos - indices[i] * uniCounterOffset[i];
}
- indices[last] = index;
+ indices[last] = pos;
return indices;
}