Skip to content

Commit 31309a6

Browse files
Fix compilation warning: add explicit cast for Math.pow
- Added explicit cast from double to int for Math.pow result - Resolves 'implicit cast is possibly lossy' compiler warning - Project uses -Werror flag which treats warnings as errors Signed-off-by: duvvuvenkataramana <venkataramana2048@gmail.com>
1 parent 6ecb0a3 commit 31309a6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/com/thealgorithms/maths/ArmstrongNumber.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public static boolean isArmstrong(int number) {
2828

2929
while (number > 0) {
3030
int digit = number % 10;
31-
sum += Math.pow(digit, digits);
31+
sum += (int) Math.pow(digit, digits);
3232
number /= 10;
3333
}
3434

0 commit comments

Comments
 (0)