Skip to content

Commit f90a8be

Browse files
authored
Merge pull request TheAlgorithms#1428 from drabbit75/master
Update AnyBaseToAnyBase.java
2 parents 03711d4 + 1e80212 commit f90a8be

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Conversions/AnyBaseToAnyBase.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ public static String base2base(String n, int b1, int b2) {
115115
// the remainder until the quotient is zero. The number in the
116116
// new base is the remainders, with the last remainder
117117
// being the left-most digit.
118-
118+
if (0 == decimalValue)
119+
return "0";
119120
// While the quotient is NOT zero:
120121
while (decimalValue != 0) {
121122
// If the remainder is a digit < 10, simply add it to

0 commit comments

Comments
 (0)