Here you can find the source of isZipFile(File f)
public static boolean isZipFile(File f)
//package com.java2s; /* ******************************************************************* * Copyright (c) 1999-2000 Xerox Corporation. * All rights reserved. // w ww . j a v a 2 s. c om * This program and the accompanying materials are made available * under the terms of the Eclipse Public License v1.0 * which accompanies this distribution and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Xerox/PARC initial implementation * ******************************************************************/ import java.io.File; public class Main { /** * @return true if file represents an existing file with a zip extension */ public static boolean isZipFile(File f) { String s = null; if ((null == f) || (null == (s = f.getPath()))) { return false; } else { return (f.canRead() && !f.isDirectory() && (s.endsWith(".zip") || (s.endsWith(".jar")))); } } }