File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
src/main/java/com/thealgorithms/conversions Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ public static String convert(String numberInWords) {
8181
8282 while (!wordDeque .isEmpty ()) {
8383 String word = wordDeque .poll ();
84- boolean currentChunkIsZero = currentChunk .equals (BigDecimal .ZERO );
84+ boolean currentChunkIsZero = currentChunk .compareTo (BigDecimal .ZERO ) == 0 ;
8585
8686 boolean isConjunction = word .equals ("and" );
8787 if (isConjunction && isValidConjunction (prevNumWasHundred , prevNumWasPowerOfTen , wordDeque )) {
@@ -161,7 +161,7 @@ public static String convert(String numberInWords) {
161161 return "Invalid Input. " + (isConjunction ? "Unexpected 'and' placement" : "Unknown Word: " + word );
162162 }
163163
164- if (!currentChunk .equals (BigDecimal .ZERO )) {
164+ if (!( currentChunk .compareTo (BigDecimal .ZERO ) == 0 )) {
165165 chunks .add (currentChunk );
166166 }
167167 BigDecimal completeNumber = combineChunks (chunks );
You can’t perform that action at this time.
0 commit comments