public String inflateByteArray2String(int numberOfBytes,byte[] bytes) throws DataFormatException {
  if (numberOfBytes == 0)   return "";
  if (numberOfBytes < 0) {
    try {
      return new String(bytes,0,-numberOfBytes,"UTF-8");
    }
 catch (    UnsupportedEncodingException e) {
      StringBuilder buf=new StringBuilder();
      for (int i=0; i < -numberOfBytes; i++)       buf.append((char)bytes[i]);
      return buf.toString();
    }
  }
  inflater.setInput(bytes,0,numberOfBytes);
  if (buffer.length < 10 * bytes.length)   buffer=new byte[10 * bytes.length];
  int resultLength=inflater.inflate(buffer);
  String outputString;
  try {
    outputString=new String(buffer,0,resultLength,"UTF-8");
  }
 catch (  UnsupportedEncodingException e) {
    StringBuilder buf=new StringBuilder();
    for (int i=0; i < resultLength; i++)     buf.append((char)buffer[i]);
    outputString=buf.toString();
  }
  inflater.reset();
  return outputString;
}

public String inflateByteArray2String ( int numberOfBytes , byte [ ] bytes ) throws DataFormatException { if ( numberOfBytes == 0 ) return "" ; if ( numberOfBytes < 0 ) { try { return new String ( bytes , 0 , - numberOfBytes , "UTF-8" ) ; } catch ( UnsupportedEncodingException e ) { StringBuilder buf = new StringBuilder ( ) ; for ( int i = 0 ; i < - numberOfBytes ; i ++ ) buf . append ( ( char ) bytes [ i ] ) ; return buf . toString ( ) ; } } inflater . setInput ( bytes , 0 , numberOfBytes ) ; if ( buffer . length < 10 * bytes . length ) buffer = new byte [ 10 * bytes . length ] ; int resultLength = inflater . inflate ( buffer ) ; String outputString ; try { outputString = new String ( buffer , 0 , resultLength , "UTF-8" ) ; } catch ( UnsupportedEncodingException e ) { StringBuilder buf = new StringBuilder ( ) ; for ( int i = 0 ; i < resultLength ; i ++ ) buf . append ( ( char ) buffer [ i ] ) ; outputString = buf . toString ( ) ; } inflater . reset ( ) ; return outputString ; }
decompresses an array of bytes to a string
