public static byte[] compressForGzip(String string) {
        ByteArrayOutputStream os = null;
        GZIPOutputStream gos = null;
        try {
            os = new ByteArrayOutputStream(string.length());
            gos = new GZIPOutputStream(os);
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
                gos.write(string.getBytes(StandardCharsets.UTF_8));
            } else {
                gos.write(string.getBytes("UTF-8"));
            }
            return os.toByteArray();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            closeQuietly(gos);
            closeQuietly(os);
        }
        return null;
    }
gzip compress 2 byte

@param string
@return
@throws IOException
arms/src/main/java/com/jess/arms/utils/ZipHelper.java