Here you can find the source of decompress(byte[] compressed)
public static byte[] decompress(byte[] compressed) throws IOException
//package com.java2s; //License from project: Creative Commons License import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.zip.GZIPInputStream; public class Main { public static byte[] decompress(byte[] compressed) throws IOException { GZIPInputStream gis = new GZIPInputStream(new ByteArrayInputStream(compressed)); ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int n;//from ww w . ja v a 2 s . c om while ((n = gis.read(buffer)) != -1) baos.write(buffer, 0, n); return baos.toByteArray(); } }