private static Collection liveMethods(final Collection classes,
			final BloatContext context) {

		// Determine the roots of the call graph
		final Set roots = new HashSet();
		Iterator iter = classes.iterator();
		while (iter.hasNext()) {
			final String className = (String) iter.next();
			try {
				final ClassEditor ce = context.editClass(className);
				final MethodInfo[] methods = ce.methods();

				for (int i = 0; i < methods.length; i++) {
					final MethodEditor me = context.editMethod(methods[i]);

					if (!me.name().equals("main")) {
						continue;
					}

					BloatBenchmark.tr("  Root " + ce.name() + "." + me.name()
							+ me.type());
					roots.add(me.memberRef());
				}

			} catch (final ClassNotFoundException ex1) {
				BloatBenchmark.err.println("** Could not find class: "
						+ ex1.getMessage());
				System.exit(1);
			}
		}

		if (roots.isEmpty()) {
			BloatBenchmark.err.print("** No main method found in classes: ");
			iter = classes.iterator();
			while (iter.hasNext()) {
				final String name = (String) iter.next();
				BloatBenchmark.err.print(name);
				if (iter.hasNext()) {
					BloatBenchmark.err.print(", ");
				}
			}
			BloatBenchmark.err.println("");
		}

		context.setRootMethods(roots);
		final CallGraph cg = context.getCallGraph();

		final Set liveMethods = new TreeSet(new MemberRefComparator());
		liveMethods.addAll(cg.liveMethods());

		return (liveMethods);
	}