diff --git a/src/main/java/org/apache/commons/math3/stat/descriptive/rank/Percentile.java b/src/main/java/org/apache/commons/math3/stat/descriptive/rank/Percentile.java index 9c7017f86..f50f8273e 100644 --- a/src/main/java/org/apache/commons/math3/stat/descriptive/rank/Percentile.java +++ b/src/main/java/org/apache/commons/math3/stat/descriptive/rank/Percentile.java @@ -486,10 +486,7 @@ public class Percentile extends AbstractUnivariateStatistic implements Serializa */ private static double[] copyOf(final double[] values, final int begin, final int length) { MathArrays.verifyValues(values, begin, length); - final double[] copy = new double[length]; - System.arraycopy(values, begin, copy, 0, - FastMath.min(length, values.length)); - return copy; + return MathArrays.copyOfRange(values, begin, begin + length); } /**