public static long calculateElapsedGC(){
  long timeMillis=0;
  for (  GarbageCollectorMXBean gcbean : gcbeans) {
    timeMillis+=gcbean.getCollectionTime();
  }
  return timeMillis;
}

public static long calculateElapsedGC ( ) { long timeMillis = 0 ; for ( GarbageCollectorMXBean gcbean : gcbeans ) { timeMillis += gcbean . getCollectionTime ( ) ; } return timeMillis ; }
ask each gc bean for its elapsed collection time
