Fix sonarqube findings
This commit is contained in:
@@ -51,7 +51,7 @@ public class HexagonalNumberGenerator implements Iterator<Long>{
|
||||
}
|
||||
|
||||
public static boolean isHexagonal(Long x){
|
||||
Long n = Math.round((Math.sqrt(1 + (8 * x)) + 1) / 4);
|
||||
Long n = Math.round((Math.sqrt(1.0 + (8 * x)) + 1) / 4);
|
||||
return ((2 * n * n) - n) == x;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class PentagonalNumberGenerator implements Iterator<Long>{
|
||||
}
|
||||
|
||||
public static boolean isPentagonal(Long x){
|
||||
Long n = Math.round((Math.sqrt(1 + (24 * x)) + 1) / 6);
|
||||
Long n = Math.round((Math.sqrt(1.0 + (24 * x)) + 1) / 6);
|
||||
return (((3 * n * n) - n) / 2) == x;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class TriangularNumberGenerator implements Iterator<Long>{
|
||||
}
|
||||
|
||||
public static boolean isTriangular(Long x){
|
||||
Long n = Math.round((Math.sqrt(1 + (8 * x)) - 1) / 2);
|
||||
Long n = Math.round((Math.sqrt(1.0 + (8 * x)) - 1) / 2);
|
||||
return (((n * n) + n) / 2) == x;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user