Update AnyBaseToAnyBase.java
fix n="0" bug
This commit is contained in:
parent
94a65964d8
commit
1e80212c23
@ -115,7 +115,8 @@ public class AnyBaseToAnyBase {
|
|||||||
// the remainder until the quotient is zero. The number in the
|
// the remainder until the quotient is zero. The number in the
|
||||||
// new base is the remainders, with the last remainder
|
// new base is the remainders, with the last remainder
|
||||||
// being the left-most digit.
|
// being the left-most digit.
|
||||||
|
if (0 == decimalValue)
|
||||||
|
return "0";
|
||||||
// While the quotient is NOT zero:
|
// While the quotient is NOT zero:
|
||||||
while (decimalValue != 0) {
|
while (decimalValue != 0) {
|
||||||
// If the remainder is a digit < 10, simply add it to
|
// If the remainder is a digit < 10, simply add it to
|
||||||
|
Loading…
Reference in New Issue
Block a user