public static void isCIDR(String network) throws IllegalArgumentException {
  String[] hostMask=network.split("/");
  if (hostMask.length != 2) {
    throw new IllegalArgumentException("subnetAddress is not a CIDR");
  }
  isValidInetAddress(hostMask[0]);
  if (Integer.parseUnsignedInt(hostMask[1]) > 32) {
    throw new IllegalArgumentException("CIDR mask may not be larger than 32");
  }
}

public static void isCIDR ( String network ) throws IllegalArgumentException { String [ ] hostMask = network . split ( "/" ) ; if ( hostMask . length != 2 ) { throw new IllegalArgumentException ( "subnetAddress is not a CIDR" ) ; } isValidInetAddress ( hostMask [ 0 ] ) ; if ( Integer . parseUnsignedInt ( hostMask [ 1 ] ) > 32 ) { throw new IllegalArgumentException ( "CIDR mask may not be larger than 32" ) ; } }
verify if cidr string is a valid cidr address .
