Here you can find the source of deflate(byte[] array)
public static void deflate(byte[] array) throws IOException
//package com.java2s; //License from project: Apache License import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.zip.InflaterInputStream; public class Main { public static void deflate(byte[] array) throws IOException { InputStream in = new InflaterInputStream(new ByteArrayInputStream(array)); ByteArrayOutputStream bos = new ByteArrayOutputStream(); shovelInToOut(in, bos);/*w ww . j a v a 2 s . c o m*/ in.close(); System.out.println(bos.toString("UTF-8")); } private static void shovelInToOut(InputStream in, OutputStream out) throws IOException { byte[] buffer = new byte[1000]; int len; while ((len = in.read(buffer)) > 0) { out.write(buffer, 0, len); } } }