From c5d2c14b6e7267a65612c4dc2770c7c212d2df4f Mon Sep 17 00:00:00 2001 From: surendranadhilla Date: Tue, 27 Aug 2024 16:14:53 -0500 Subject: [PATCH] I have Updated Maths/AverageUpdation --- src/main/java/com/thealgorithms/maths/Average.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/thealgorithms/maths/Average.java b/src/main/java/com/thealgorithms/maths/Average.java index 6b9c20162da1..bf3b729949cc 100644 --- a/src/main/java/com/thealgorithms/maths/Average.java +++ b/src/main/java/com/thealgorithms/maths/Average.java @@ -5,6 +5,7 @@ * This class provides static methods to calculate the average of arrays * of both {@code double} and {@code int} values. */ + public final class Average { // Prevent instantiation of this utility class @@ -21,7 +22,7 @@ private Average() { */ public static double average(double[] numbers) { if (numbers == null || numbers.length == 0) { - throw new IllegalArgumentException("Numbers array cannot be empty or null"); + throw new IllegalArgumentException("Numbers array are cannot be empty or null"); } double sum = 0; for (double number : numbers) { @@ -39,7 +40,7 @@ public static double average(double[] numbers) { */ public static double average(int[] numbers) { if (numbers == null || numbers.length == 0) { - throw new IllegalArgumentException("Numbers array cannot be empty or null"); + throw new IllegalArgumentException("Numbers array are cannot be empty or null"); } long sum = 0; for (int number : numbers) {