private static int checkNumericZone(String s) throws UnknownHostException {
  int percent=s.indexOf('%');
  int slen=s.length();
  int digit, zone=0;
  if (percent == -1) {
    return -1;
  }
  for (int i=percent + 1; i < slen; i++) {
    char c=s.charAt(i);
    if (c == ']') {
      if (i == percent + 1) {
        return -1;
      }
      break;
    }
    if ((digit=Character.digit(c,10)) < 0) {
      return -1;
    }
    zone=(zone * 10) + digit;
  }
  return zone;
}

private static int checkNumericZone ( String s ) throws UnknownHostException { int percent = s . indexOf ( '%' ) ; int slen = s . length ( ) ; int digit , zone = 0 ; if ( percent == - 1 ) { return - 1 ; } for ( int i = percent + 1 ; i < slen ; i ++ ) { char c = s . charAt ( i ) ; if ( c == ']' ) { if ( i == percent + 1 ) { return - 1 ; } break ; } if ( ( digit = Character . digit ( c , 10 ) ) < 0 ) { return - 1 ; } zone = ( zone * 10 ) + digit ; } return zone ; }
check if the literal address string has % nn appended returns - 1 if not , or the numeric value otherwise . % nn may also be a string that represents the displayname of a currently available networkinterface .
