MonitoringInfoEncodings { public static ByteString encodeDoubleDistribution( long count, double sum, double min, double max) { ByteString.Output output = ByteString.newOutput(); try { VARINT_CODER.encode(count, output); DOUBLE_CODER.encode(sum, output); DOUBLE_CODER.encode(min, output); DOUBLE_CODER.encode(max, output); } catch (IOException e) { throw new RuntimeException(e); } return output.toByteString(); }  static ByteString encodeInt64Distribution(DistributionData data); static DistributionData decodeInt64Distribution(ByteString payload); static ByteString encodeDoubleDistribution(
      long count, double sum, double min, double max); static ByteString encodeInt64Gauge(GaugeData data); static GaugeData decodeInt64Gauge(ByteString payload); static ByteString encodeInt64Counter(long value); static long decodeInt64Counter(ByteString payload); static ByteString encodeDoubleCounter(double value); static double decodeDoubleCounter(ByteString payload);  }
@Test public void testDoubleDistributionEncoding() { ByteString payload = encodeDoubleDistribution(1L, 2.0, 3.0, 4.0); assertEquals( ByteString.copyFrom( new byte[] { 1, 64, 0, 0, 0, 0, 0, 0, 0, 64, 8, 0, 0, 0, 0, 0, 0, 64, 16, 0, 0, 0, 0, 0, 0 }), payload); }