Skip to content

Commit 88d65ff

Browse files
authored
Merge pull request TheAlgorithms#1347 from lollerfirst/patch-1, close TheAlgorithms#1345
Update ParseInteger.java
2 parents 4ac4a62 + 7179718 commit 88d65ff

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Maths/ParseInteger.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public static void main(String[] args) {
1616
* @throws NumberFormatException if the {@code string} does not contain a parsable integer.
1717
*/
1818
public static int parseInt(String s) {
19-
if (s == null) {
19+
if (s == null || s.length() == 0) {
2020
throw new NumberFormatException("null");
2121
}
2222
boolean isNegative = s.charAt(0) == '-';

0 commit comments

Comments
 (0)