Skip to content

Commit 3d58312

Browse files
committed
solve build error
1 parent a5b4072 commit 3d58312

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/main/java/com/thealgorithms/conversions/WordsToNumber.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
import java.math.BigDecimal;
44
import java.util.*;
55

6+
/**
7+
A Java-based utility for converting English word representations of numbers
8+
into their numeric form. This utility supports whole numbers, decimals,
9+
large values up to trillions, and even scientific notation where applicable.
10+
It ensures accurate parsing while handling edge cases like negative numbers,
11+
improper word placements, and ambiguous inputs.
12+
*
13+
*/
14+
615
public final class WordsToNumber {
716
private WordsToNumber() {
817
}
@@ -97,13 +106,13 @@ public static String convert(String numberInWords) {
97106

98107
Integer number = NUMBER_MAP.getOrDefault(word, null);
99108
if (number != null) {
100-
if (number == 0 && !(currentChunkIsZero && chunks.isEmpty())) return "Invalid Input. Unexpected word: " + word;
109+
if (number == 0 && !(currentChunkIsZero && chunks.isEmpty())) return "Invalid Input. Unexpected Word: " + word;
101110
BigDecimal bigDecimalNumber = BigDecimal.valueOf(number);
102111

103112
if (currentChunkIsZero || isAdditionSafe(currentChunk, bigDecimalNumber))
104113
currentChunk = currentChunk.add(bigDecimalNumber);
105114
else
106-
return "Invalid Input. Unexpected word: " + word;
115+
return "Invalid Input. Unexpected Word: " + word;
107116
continue;
108117
}
109118

0 commit comments

Comments
 (0)