mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-05 16:27:33 +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;
|
||||
}
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ public final class KochSnowflake {
|
||||
double offsetX = imageWidth / 10.;
|
||||
double offsetY = imageWidth / 3.7;
|
||||
Vector2 vector1 = new Vector2(offsetX, offsetY);
|
||||
Vector2 vector2 = new Vector2(imageWidth / 2, Math.sin(Math.PI / 3) * imageWidth * 0.8 + offsetY);
|
||||
Vector2 vector2 = new Vector2(imageWidth / 2.0, Math.sin(Math.PI / 3.0) * imageWidth * 0.8 + offsetY);
|
||||
Vector2 vector3 = new Vector2(imageWidth - offsetX, offsetY);
|
||||
ArrayList<Vector2> initialVectors = new ArrayList<Vector2>();
|
||||
initialVectors.add(vector1);
|
||||
|
Reference in New Issue
Block a user