mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-12-19 07:00:35 +08:00
style: include ICAST_IDIV_CAST_TO_DOUBLE (#6121)
This commit is contained in:
@@ -37,7 +37,7 @@ public final class Average {
|
||||
* @return the average of the given numbers
|
||||
* @throws IllegalArgumentException if the input array is {@code null} or empty
|
||||
*/
|
||||
public static double average(int[] numbers) {
|
||||
public static long average(int[] numbers) {
|
||||
if (numbers == null || numbers.length == 0) {
|
||||
throw new IllegalArgumentException("Numbers array cannot be empty or null");
|
||||
}
|
||||
@@ -45,6 +45,6 @@ public final class Average {
|
||||
for (int number : numbers) {
|
||||
sum += number;
|
||||
}
|
||||
return (double) (sum / numbers.length);
|
||||
return sum / numbers.length;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user