code: public static boolean isCompressed(byte[] bytes) throws IOException {
          return bytes != null && bytes.length >= 2 &&
                  bytes[0] == (byte) (GZIPInputStream.GZIP_MAGIC) && bytes[1] == (byte) (GZIPInputStream.GZIP_MAGIC >> 8);
      }
docs: Determines if a byte array is compressed. The java.util.zip GZip
  implementation does not expose the GZip header so it is difficult to determine
  if a string is compressed.
  
  @param bytes an array of bytes
  @return true if the array is compressed or false otherwise
  @throws java.io.IOException if the byte array couldn't be read