protected static Map<Byte, Double> parseMetricsMap(ByteBuffer buffer) {
        Map<Byte, Double> metricsMap = new HashMap<>();
        int metricNumber = buffer.getInt();
        for (int i = 0; i < metricNumber; i++) {
            byte id = buffer.get();
            double value = buffer.getDouble();
            metricsMap.put(id, value);
        }
        return metricsMap;
    }
This class was modified based on Cruise Control: com.linkedin.kafka.cruisecontrol.metricsreporter.metric.CruiseControlMetric.
core/src/main/java/kafka/autobalancer/metricsreporter/metric/AutoBalancerMetrics.java