code: public static int getParameterCount(String methodDescriptor) {
  		int pos = 1; // after the '('
  		int count = 0;
  		char ch;
  		while ((ch = methodDescriptor.charAt(pos)) != ')') {
  			// Either 'L' or '[' or primitive
  			if (ch == 'L') {
  				// skip to ';'
  				pos = methodDescriptor.indexOf(';', pos + 1);
  			}
  			else if (ch == '[') {
  				while (methodDescriptor.charAt(++pos) == '[') {
  				}
  				if (methodDescriptor.charAt(pos) == 'L') {
  					// reference array like [[Ljava/lang/String;
  					pos = methodDescriptor.indexOf(';', pos + 1);
  				}
  			}
  			count++;
  			pos++;
  		}
  		return count;
  	}
docs: Return the number of parameters in the descriptor. Copes with primitives and arrays and reference types.
  
  @param methodDescriptor a method descriptor of the form (Ljava/lang/String;I[[Z)I
  @return number of parameters in the descriptor