public static byte[] decompressForZlib(byte[] bytesToDecompress){
  byte[] returnValues=null;
  Inflater inflater=new Inflater();
  int numberOfBytesToDecompress=bytesToDecompress.length;
  inflater.setInput(bytesToDecompress,0,numberOfBytesToDecompress);
  int bufferSizeInBytes=numberOfBytesToDecompress;
  int numberOfBytesDecompressedSoFar=0;
  List<Byte> bytesDecompressedSoFar=new ArrayList<Byte>();
  try {
    while (inflater.needsInput() == false) {
      byte[] bytesDecompressedBuffer=new byte[bufferSizeInBytes];
      int numberOfBytesDecompressedThisTime=inflater.inflate(bytesDecompressedBuffer);
      numberOfBytesDecompressedSoFar+=numberOfBytesDecompressedThisTime;
      for (int b=0; b < numberOfBytesDecompressedThisTime; b++) {
        bytesDecompressedSoFar.add(bytesDecompressedBuffer[b]);
      }
    }
    returnValues=new byte[bytesDecompressedSoFar.size()];
    for (int b=0; b < returnValues.length; b++) {
      returnValues[b]=(byte)(bytesDecompressedSoFar.get(b));
    }
  }
 catch (  DataFormatException dfe) {
    dfe.printStackTrace();
  }
  inflater.end();
  return returnValues;
}

public static byte [ ] decompressForZlib ( byte [ ] bytesToDecompress ) { byte [ ] returnValues = null ; Inflater inflater = new Inflater ( ) ; int numberOfBytesToDecompress = bytesToDecompress . length ; inflater . setInput ( bytesToDecompress , 0 , numberOfBytesToDecompress ) ; int bufferSizeInBytes = numberOfBytesToDecompress ; int numberOfBytesDecompressedSoFar = 0 ; List < Byte > bytesDecompressedSoFar = new ArrayList < Byte > ( ) ; try { while ( inflater . needsInput ( ) == false ) { byte [ ] bytesDecompressedBuffer = new byte [ bufferSizeInBytes ] ; int numberOfBytesDecompressedThisTime = inflater . inflate ( bytesDecompressedBuffer ) ; numberOfBytesDecompressedSoFar += numberOfBytesDecompressedThisTime ; for ( int b = 0 ; b < numberOfBytesDecompressedThisTime ; b ++ ) { bytesDecompressedSoFar . add ( bytesDecompressedBuffer [ b ] ) ; } } returnValues = new byte [ bytesDecompressedSoFar . size ( ) ] ; for ( int b = 0 ; b < returnValues . length ; b ++ ) { returnValues [ b ] = ( byte ) ( bytesDecompressedSoFar . get ( b ) ) ; } } catch ( DataFormatException dfe ) { dfe . printStackTrace ( ) ; } inflater . end ( ) ; return returnValues ; }
zlib decompress 2 byte
