Created
January 3, 2019 20:57
-
-
Save a6y3ap/d24cf2e7f68ba8573605ab353d7713a1 to your computer and use it in GitHub Desktop.
Check if string is a valid number (Java)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static boolean isValid(String value) { | |
try { new java.math.BigInteger(value); } | |
catch (Exception e) { return false; } | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment