### Question:
GzipUtil { public static byte[] compress(byte[] bytes) { if (bytes == null) { throw new NullPointerException("bytes is null"); } ByteArrayOutputStream out = new ByteArrayOutputStream(); try (GZIPOutputStream gzip = new GZIPOutputStream(out)) { gzip.write(bytes); gzip.flush(); gzip.finish(); return out.toByteArray(); } catch (IOException e) { throw new RuntimeException("gzip compress error", e); } } private  GzipUtil(); static byte[] compress(byte[] bytes); static byte[] decompress(byte[] bytes);  }### Answer:
@Test public void test_compress() { Assertions.assertThrows(NullPointerException.class, () -> { GzipUtil.compress(null); }); byte[] compress = GzipUtil.compress("aa".getBytes()); int head = ((int) compress[0] & 0xff) | ((compress[1] << 8) & 0xff00); Assertions.assertEquals(GZIPInputStream.GZIP_MAGIC, head); }