Skip to content

Commit bcb286b

Browse files
committed
Fix
1 parent 59dd1dc commit bcb286b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ private IntegerToEnglish() {
4141
*/
4242
private static String convertToWords(int number) {
4343
int remainder = number % 100;
44-
String result;
44+
String result = "";
4545

4646
if (remainder <= 20) {
4747
result = BASE_NUMBERS_MAP.get(remainder);
@@ -58,7 +58,7 @@ private static String convertToWords(int number) {
5858
result = String.format("%s Hundred%s%s", BASE_NUMBERS_MAP.get(hundredsDigit), result.isEmpty() ? "" : " ", result);
5959
}
6060

61-
return result.trim();
61+
return result != null ? result.trim() : "";
6262
}
6363

6464
/**

0 commit comments

Comments
 (0)