code: public static byte[] gzip(String input) {
          ByteArrayOutputStream baos = new ByteArrayOutputStream();
          GZIPOutputStream gzos = null;
  
          try {
              gzos = new GZIPOutputStream(baos);
              gzos.write(input.getBytes("UTF-8"));
          } catch (IOException e) {
              e.printStackTrace();
          } finally {
              if (gzos != null) {
                  try {
                      gzos.close();
                  } catch (IOException ignore) {
                  }
              }
          }
  
          return baos.toByteArray();
      }
docs: GZip compress a string of bytes
  
  @param input
  @return a byte array