mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-11 22:22:21 +08:00
Explicitly cast result of Math.pow
to int
in BinaryToHexadecimal
(#4970)
This commit is contained in:
@ -34,7 +34,7 @@ public class BinaryToHexadecimal {
|
|||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
currbit = binary % 10;
|
currbit = binary % 10;
|
||||||
binary = binary / 10;
|
binary = binary / 10;
|
||||||
code4 += currbit * Math.pow(2, i);
|
code4 += currbit * (int) Math.pow(2, i);
|
||||||
}
|
}
|
||||||
hex = hm.get(code4) + hex;
|
hex = hm.get(code4) + hex;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user