style: include ICAST_IDIV_CAST_TO_DOUBLE (#6121)

This commit is contained in:
Piotr Idzik
2025-01-10 19:50:09 +01:00
committed by GitHub
parent 5ab6356090
commit a9633c0000
3 changed files with 3 additions and 6 deletions

View File

@@ -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;
}
}