public final static boolean isPotentialZipArchive(String name){
  int lastDot=name.lastIndexOf('.');
  if (lastDot == -1) {
    return false;
  }
  if (name.lastIndexOf(File.separatorChar) > lastDot) {
    return false;
  }
  int length=name.length();
  int extensionLength=length - lastDot - 1;
  if (extensionLength == EXTENSION_java.length()) {
    for (int i=extensionLength - 1; i >= 0; i--) {
      if (Character.toLowerCase(name.charAt(length - extensionLength + i)) != EXTENSION_java.charAt(i)) {
        break;
      }
      if (i == 0) {
        return false;
      }
    }
  }
  if (extensionLength == EXTENSION_class.length()) {
    for (int i=extensionLength - 1; i >= 0; i--) {
      if (Character.toLowerCase(name.charAt(length - extensionLength + i)) != EXTENSION_class.charAt(i)) {
        return true;
      }
    }
    return false;
  }
  return true;
}

public final static boolean isPotentialZipArchive ( String name ) { int lastDot = name . lastIndexOf ( '.' ) ; if ( lastDot == - 1 ) { return false ; } if ( name . lastIndexOf ( File . separatorChar ) > lastDot ) { return false ; } int length = name . length ( ) ; int extensionLength = length - lastDot - 1 ; if ( extensionLength == EXTENSION_java . length ( ) ) { for ( int i = extensionLength - 1 ; i >= 0 ; i -- ) { if ( Character . toLowerCase ( name . charAt ( length - extensionLength + i ) ) != EXTENSION_java . charAt ( i ) ) { break ; } if ( i == 0 ) { return false ; } } } if ( extensionLength == EXTENSION_class . length ( ) ) { for ( int i = extensionLength - 1 ; i >= 0 ; i -- ) { if ( Character . toLowerCase ( name . charAt ( length - extensionLength + i ) ) != EXTENSION_class . charAt ( i ) ) { return true ; } } return false ; } return true ; }
returns whether the given name is potentially a zip archive file name ( it has a file extension and it is not " . java " nor " . class " )
