This Java tip illustrates an example of decompressing a Byte Array. Developer may decompresses a byte array that was compressed using the Deflater class.

 // Create the decompressor and give it the data to compress
    Inflater decompressor = new Inflater();
    // Create an expandable byte array to hold the decompressed data
    ByteArrayOutputStream bos = new ByteArrayOutputStream(compressedData.length);
    // Decompress the data
    byte[] buf = new byte[1024];
    while (!decompressor.finished()) {
        try {
            int count = decompressor.inflate(buf);
            bos.write(buf, 0, count);
        } catch (DataFormatException e) {
    try {
    } catch (IOException e) {
    // Get the decompressed data
    byte[] decompressedData = bos.toByteArray();