File tree 1 file changed +2
-2
lines changed
src/main/java/com/thealgorithms/conversions
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) {
81
81
82
82
while (!wordDeque .isEmpty ()) {
83
83
String word = wordDeque .poll ();
84
- boolean currentChunkIsZero = currentChunk .equals (BigDecimal .ZERO );
84
+ boolean currentChunkIsZero = currentChunk .compareTo (BigDecimal .ZERO ) == 0 ;
85
85
86
86
boolean isConjunction = word .equals ("and" );
87
87
if (isConjunction && isValidConjunction (prevNumWasHundred , prevNumWasPowerOfTen , wordDeque )) {
@@ -161,7 +161,7 @@ public static String convert(String numberInWords) {
161
161
return "Invalid Input. " + (isConjunction ? "Unexpected 'and' placement" : "Unknown Word: " + word );
162
162
}
163
163
164
- if (!currentChunk .equals (BigDecimal .ZERO )) {
164
+ if (!( currentChunk .compareTo (BigDecimal .ZERO ) == 0 )) {
165
165
chunks .add (currentChunk );
166
166
}
167
167
BigDecimal completeNumber = combineChunks (chunks );
You can’t perform that action at this time.
0 commit comments