Here you can find the source of isZip(File file)
public static boolean isZip(File file)
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.util.zip.ZipInputStream; public class Main { public static boolean isZip(File file) { try (FileInputStream inputStream = new FileInputStream(file)) { return new ZipInputStream(inputStream).getNextEntry() != null; } catch (IOException e) { throw new RuntimeException("Problem to check if file " + file.getPath() + " is a zip", e); }/*from w w w . j ava2 s . c om*/ } }