From 1e80212c23224ec74fedd903c4e983d4f7d37b3e Mon Sep 17 00:00:00 2001 From: rabbit Date: Fri, 21 Aug 2020 15:48:22 +0800 Subject: [PATCH] Update AnyBaseToAnyBase.java fix n="0" bug --- Conversions/AnyBaseToAnyBase.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Conversions/AnyBaseToAnyBase.java b/Conversions/AnyBaseToAnyBase.java index 2cef9926..8ecc7990 100644 --- a/Conversions/AnyBaseToAnyBase.java +++ b/Conversions/AnyBaseToAnyBase.java @@ -115,7 +115,8 @@ public class AnyBaseToAnyBase { // the remainder until the quotient is zero. The number in the // new base is the remainders, with the last remainder // being the left-most digit. - + if (0 == decimalValue) + return "0"; // While the quotient is NOT zero: while (decimalValue != 0) { // If the remainder is a digit < 10, simply add it to