Here you can find the source of unZip(File zipPath, File destPath)
public static void unZip(File zipPath, File destPath) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; public class Main { public static void unZip(File zipPath, File destPath) throws IOException { if (!destPath.exists()) { destPath.mkdirs();//from ww w. j ava 2s . c o m } ZipInputStream in = new ZipInputStream(new FileInputStream(zipPath)); ZipEntry entry = in.getNextEntry(); while (entry != null) { String filePath = destPath + File.separator + entry.getName(); if (!entry.isDirectory()) { extract(in, filePath); } else { File dir = new File(filePath); dir.mkdir(); } in.closeEntry(); entry = in.getNextEntry(); } in.close(); } private static void extract(ZipInputStream in, String filePath) throws IOException { BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(filePath)); byte[] bytes = new byte[4096]; int read; while ((read = in.read(bytes)) != -1) { bos.write(bytes, 0, read); } bos.close(); } }