public boolean isValidInet4Address(String inet4Address){
  String[] groups=ipv4Validator.match(inet4Address);
  if (groups == null) {
    return false;
  }
  for (  String ipSegment : groups) {
    if (ipSegment == null || ipSegment.length() == 0) {
      return false;
    }
    int iIpSegment=0;
    try {
      iIpSegment=Integer.parseInt(ipSegment);
    }
 catch (    NumberFormatException e) {
      return false;
    }
    if (iIpSegment > IPV4_MAX_OCTET_VALUE) {
      return false;
    }
    if (ipSegment.length() > 1 && ipSegment.startsWith("0")) {
      return false;
    }
  }
  return true;
}

public boolean isValidInet4Address ( String inet4Address ) { String [ ] groups = ipv4Validator . match ( inet4Address ) ; if ( groups == null ) { return false ; } for ( String ipSegment : groups ) { if ( ipSegment == null || ipSegment . length ( ) == 0 ) { return false ; } int iIpSegment = 0 ; try { iIpSegment = Integer . parseInt ( ipSegment ) ; } catch ( NumberFormatException e ) { return false ; } if ( iIpSegment > IPV4_MAX_OCTET_VALUE ) { return false ; } if ( ipSegment . length ( ) > 1 && ipSegment . startsWith ( "0" ) ) { return false ; } } return true ; }
validates an ipv4 address . returns true if valid .
