public static long getLastGcDuration(ObjectName gcCollector) {
    long lastGcDuration = 0;
    Object lastGcInfo = getValueFromMBean(gcCollector, "LastGcInfo");
    if (lastGcInfo != null && lastGcInfo instanceof CompositeData) {
      CompositeData cds = (CompositeData) lastGcInfo;
      lastGcDuration = (long) cds.get("duration");
    }
    return lastGcDuration;
  }
Method for building map used for constructing ObjectName. Mapping is done with arrays indices
@param keys   Map keys
@param values Map values
@return Map or null if arrays are empty or have different number of elements
hbase-http/src/main/java/org/apache/hadoop/hbase/util/JSONMetricUtil.java