Skip to content

Commit dfc9f3a

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 30aa66e + e759544 commit dfc9f3a

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/main/java/com/thealgorithms/conversions/BinaryToHexadecimal.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ static String binToHex(int binary) {
3434
for (i = 0; i < 4; i++) {
3535
currbit = binary % 10;
3636
binary = binary / 10;
37-
code4 += currbit * Math.pow(2, i);
37+
code4 += currbit * (int) Math.pow(2, i);
3838
}
3939
hex = hm.get(code4) + hex;
4040
}

src/main/java/com/thealgorithms/greedyalgorithms/FractionalKnapsack.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static int fractionalKnapsack(int weight[], int value[], int capacity) {
3232
current -= weight[index];
3333
} else {
3434
// If only a fraction of the item can fit, add a proportionate value.
35-
finalValue += ratio[i][1] * current;
35+
finalValue += (int) (ratio[i][1] * current);
3636
break; // Stop adding items to the knapsack since it's full.
3737
}
3838
}

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

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

2828
while (originalNumber > 0) {
2929
long digit = originalNumber % 10;
30-
sum += Math.pow(digit, power); // The digit raised to the power of the number of digits and added to the sum.
30+
sum += (long) Math.pow(digit, power); // The digit raised to the power of the number of digits and added to the sum.
3131
originalNumber /= 10;
3232
}
3333

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public static boolean isHarshad(long n) {
1515
if (n <= 0) return false;
1616

1717
long t = n;
18-
int sumOfDigits = 0;
18+
long sumOfDigits = 0;
1919
while (t > 0) {
2020
sumOfDigits += t % 10;
2121
t /= 10;

0 commit comments

Comments
 (0)