public static AutoBalancerMetrics fromBytes(byte[] bytes) throws UnknownVersionException {
        ByteBuffer buffer = ByteBuffer.wrap(bytes);

        switch (buffer.get()) {
            case MetricTypes.TOPIC_PARTITION_METRIC:
                return TopicPartitionMetrics.fromBuffer(buffer);
            case MetricTypes.BROKER_METRIC:
                return BrokerMetrics.fromBuffer(buffer);
            default:
                // This could happen when a new type of metric is added, but we are still running the old code.
                // simply ignore the metric by returning a null.
                return null;
        }
    }
Deserialize from byte array to Auto Balancer metric

@param bytes Bytes array corresponding to Auto Balancer metric.
@return Deserialized byte array as Auto Balancer metric.
core/src/main/java/kafka/autobalancer/metricsreporter/metric/MetricSerde.java