Here you can find the source of decompress(byte[] compressed)
public static String decompress(byte[] compressed) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.*; import java.util.zip.GZIPInputStream; public class Main { public static String decompress(byte[] compressed) throws IOException { final int BUFFER_SIZE = 32; ByteArrayInputStream is = new ByteArrayInputStream(compressed); GZIPInputStream gis = new GZIPInputStream(is, BUFFER_SIZE); StringBuilder string = new StringBuilder(); byte[] data = new byte[BUFFER_SIZE]; int bytesRead; while ((bytesRead = gis.read(data)) != -1) { string.append(new String(data, 0, bytesRead)); }//from w w w .ja va2s.co m gis.close(); is.close(); return string.toString(); } }