public static int numOfParameters(String desc){
  int n=0;
  int i=1;
  for (; ; ) {
    char c=desc.charAt(i);
    if (c == ')')     break;
    while (c == '[')     c=desc.charAt(++i);
    if (c == 'L') {
      i=desc.indexOf(';',i) + 1;
      if (i <= 0)       throw new IndexOutOfBoundsException("bad descriptor");
    }
 else     ++i;
    ++n;
  }
  return n;
}

public static int numOfParameters ( String desc ) { int n = 0 ; int i = 1 ; for ( ; ; ) { char c = desc . charAt ( i ) ; if ( c == ')' ) break ; while ( c == '[' ) c = desc . charAt ( ++ i ) ; if ( c == 'L' ) { i = desc . indexOf ( ';' , i ) + 1 ; if ( i <= 0 ) throw new IndexOutOfBoundsException ( "bad descriptor" ) ; } else ++ i ; ++ n ; } return n ; }
returns the number of the prameters included in the given descriptor .
