Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- boolean isIPv4Address(String inputString) {
- String[] check = inputString.split(Pattern.quote("."));
- if(check.length == 4) {
- for(int i = 0; i < check.length; i++) {
- if(check[i].length() > 0 && check[i].matches("[0-9]{1,3}") && (Integer.parseInt(check[i]) > 255 || Integer.parseInt(check[i]) < 0)) {
- return false;
- }
- }
- return true;
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement