From 099cde5e5a815645a71569ccf41be1c42bb3def9 Mon Sep 17 00:00:00 2001 From: vil02 Date: Thu, 30 Nov 2023 07:31:32 +0100 Subject: [PATCH] fix: explicitly cast result of `Math.pow` to `long` in `Armstrong` --- src/main/java/com/thealgorithms/maths/Armstrong.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/thealgorithms/maths/Armstrong.java b/src/main/java/com/thealgorithms/maths/Armstrong.java index 526b31c3891f..ff4ae027a0b7 100644 --- a/src/main/java/com/thealgorithms/maths/Armstrong.java +++ b/src/main/java/com/thealgorithms/maths/Armstrong.java @@ -27,7 +27,7 @@ public boolean isArmstrong(int number) { while (originalNumber > 0) { long digit = originalNumber % 10; - sum += Math.pow(digit, power); // The digit raised to the power of the number of digits and added to the sum. + sum += (long) Math.pow(digit, power); // The digit raised to the power of the number of digits and added to the sum. originalNumber /= 10; }