code: public static int getSize(String descriptor) {
  		int size = 0;
  		int descriptorpos = 1; // start after the '('
  		char ch;
  		while ((ch = descriptor.charAt(descriptorpos)) != ')') {
  			switch (ch) {
  				case '[':
  					size++;
  					// jump to end of array, could be [[[[I
  					while (descriptor.charAt(++descriptorpos) == '[') {
  						;
  					}
  					if (descriptor.charAt(descriptorpos) == 'L') {
  						descriptorpos = descriptor.indexOf(';', descriptorpos) + 1;
  					}
  					else {
  						// Just a primitive array
  						descriptorpos++;
  					}
  					break;
  				case 'L':
  					size++;
  					// jump to end of 'L' signature
  					descriptorpos = descriptor.indexOf(';', descriptorpos) + 1;
  					break;
  				case 'J':
  					size = size + 2;
  					descriptorpos++;
  					break;
  				case 'D':
  					size = size + 2;
  					descriptorpos++;
  					break;
  				case 'F':
  				case 'B':
  				case 'S':
  				case 'I':
  				case 'Z':
  				case 'C':
  					size++;
  					descriptorpos++;
  					break;
  				default:
  					throw new IllegalStateException("Unexpected character in descriptor: " + ch);
  			}
  		}
  		return size;
  	}
docs: Compute the size required for a specific method descriptor.
  
  @param descriptor a method descriptor, for example (Ljava/lang/String;ZZ)V
  @return number of stack/var entries necessary for that descriptor