private static int checkTypeSignature(String sig,int start,int end,boolean allowVoid){
  if (start >= end)   return -1;
  int i=start;
  char c=sig.charAt(i++);
  int nestingDepth=0;
  while (c == '[') {
    ++nestingDepth;
    if (i >= end)     return -1;
    c=sig.charAt(i++);
  }
switch (c) {
case 'B':
case 'C':
case 'D':
case 'F':
case 'I':
case 'J':
case 'S':
case 'Z':
    break;
case 'V':
  if (!allowVoid)   return -1;
if (nestingDepth != 0) return -1;
break;
case 'L':
int semicolon=sig.indexOf(';',i);
if (semicolon <= i || semicolon >= end) return -1;
i=semicolon + 1;
break;
default :
return -1;
}
return i;
}

private static int checkTypeSignature ( String sig , int start , int end , boolean allowVoid ) { if ( start >= end ) return - 1 ; int i = start ; char c = sig . charAt ( i ++ ) ; int nestingDepth = 0 ; while ( c == '[' ) { ++ nestingDepth ; if ( i >= end ) return - 1 ; c = sig . charAt ( i ++ ) ; } switch ( c ) { case 'B' : case 'C' : case 'D' : case 'F' : case 'I' : case 'J' : case 'S' : case 'Z' : break ; case 'V' : if ( ! allowVoid ) return - 1 ; if ( nestingDepth != 0 ) return - 1 ; break ; case 'L' : int semicolon = sig . indexOf ( ';' , i ) ; if ( semicolon <= i || semicolon >= end ) return - 1 ; i = semicolon + 1 ; break ; default : return - 1 ; } return i ; }
checks the type signature in string sig , starting at start and ending before end ( end is not included ) . returns the index of the character immediately after the signature if valid , or - 1 if not valid .
