Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Check parseInt
  • Loading branch information
nhattech committed Sep 12, 2022
commit 1d8b3ae01f49ee557e98d79c5cc628a53f5333ef
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ public class RecursiveDigitSum {
private static int superDigit(String n, int k) {
if(n == null) throw new Exception("by input exception [" + n + "]");
if (n.length() == 1 && k == 0) {
return Integer.parseInt(n);
try {
return Integer.parseInt(n);
}catch (Exception e) {
throw new Exception("by input exception [" + n + "]");
}
}

Long sum = 0L;
Expand Down