Here you can find the source of unzip(byte[] bytes)
public static byte[] unzip(byte[] bytes)
//package com.java2s; //License from project: Apache License import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.zip.GZIPInputStream; public class Main { public static byte[] unzip(byte[] bytes) { try {//from w ww.j a va 2s. c om GZIPInputStream gis = new GZIPInputStream(new ByteArrayInputStream(bytes)); ByteArrayOutputStream bos = new ByteArrayOutputStream(); byte[] buff = new byte[512]; int read = gis.read(buff); while (read > 0) { bos.write(buff, 0, read); read = gis.read(buff); } gis.close(); bos.close(); return bos.toByteArray(); } catch (IOException e) { e.printStackTrace(); } return new byte[0]; } }