public static int indexOfJavaLikeExtension(String fileName){
  int fileNameLength=fileName.length();
  char[][] javaLikeExtensions=getJavaLikeExtensions();
  extensions:   for (int i=0, length=javaLikeExtensions.length; i < length; i++) {
    char[] extension=javaLikeExtensions[i];
    int extensionLength=extension.length;
    int extensionStart=fileNameLength - extensionLength;
    int dotIndex=extensionStart - 1;
    if (dotIndex < 0)     continue;
    if (fileName.charAt(dotIndex) != '.')     continue;
    for (int j=0; j < extensionLength; j++) {
      if (fileName.charAt(extensionStart + j) != extension[j])       continue extensions;
    }
    return dotIndex;
  }
  return -1;
}

public static int indexOfJavaLikeExtension ( String fileName ) { int fileNameLength = fileName . length ( ) ; char [ ] [ ] javaLikeExtensions = getJavaLikeExtensions ( ) ; extensions : for ( int i = 0 , length = javaLikeExtensions . length ; i < length ; i ++ ) { char [ ] extension = javaLikeExtensions [ i ] ; int extensionLength = extension . length ; int extensionStart = fileNameLength - extensionLength ; int dotIndex = extensionStart - 1 ; if ( dotIndex < 0 ) continue ; if ( fileName . charAt ( dotIndex ) != '.' ) continue ; for ( int j = 0 ; j < extensionLength ; j ++ ) { if ( fileName . charAt ( extensionStart + j ) != extension [ j ] ) continue extensions ; } return dotIndex ; } return - 1 ; }
returns the index of the java like extension of the given file name or - 1 if it doesn ' t end with a known java like extension . note this is the index of the ' . ' even if it is not considered part of the extension .
