Here you can find the source of unzip(byte[] bytes)
public static byte[] unzip(byte[] bytes) throws Exception
//package com.java2s; //License from project: Open Source License import java.io.ByteArrayOutputStream; import java.util.zip.Inflater; public class Main { /**//from w w w. ja va 2 s . c o m * Decompresses the given byte array using the standard Java inflater (which * uses the zlib compression library internally). */ public static byte[] unzip(byte[] bytes) throws Exception { if (bytes == null) return null; if (bytes.length == 0) return new byte[0]; Inflater inflater = new Inflater(); inflater.setInput(bytes); ByteArrayOutputStream out = new ByteArrayOutputStream(bytes.length); byte[] buffer = new byte[1024]; while (!inflater.finished()) { int count = inflater.inflate(buffer); out.write(buffer, 0, count); } out.close(); return out.toByteArray(); } }