if (args.length>1 || (args.length>0 && "-help".equals(args[0]))) { System.err.println("Usage: " + DefectDensity.class.getName() + " [<infile>]"); System.exit(1); }
	public static void main(String args[]) throws Exception {		Project project = new Project();		BugCollection origCollection = new SortedBugCollection();		int argCount = 0;		if (argCount == args.length)			origCollection.readXML(System.in, project);		else			origCollection.readXML(args[argCount], project);		ProjectStats stats = origCollection.getProjectStats();		printRow("kind", "name", "density/KNCSS", "bugs", "NCSS");		double projectDensity = density(stats.getTotalBugs(),  stats.getCodeSize());		printRow("project", origCollection.getCurrentAppVersion().getReleaseName(), 				projectDensity, stats.getTotalBugs(),				stats.getCodeSize());		for (PackageStats p : stats.getPackageStats()) if (p.getTotalBugs() > 4) {										double packageDensity = density( p.getTotalBugs(),p.size());				if (Double.isNaN(packageDensity) || packageDensity < projectDensity) continue;				printRow("package", p.getPackageName(), 						packageDensity, p.getTotalBugs(), p.size());			for (ClassStats c : p.getClassStats()) if (c.getTotalBugs() > 4) {				double density = density( c.getTotalBugs(), c.size());				if (Double.isNaN(density) || density < packageDensity) continue;				printRow("class", c.getName(), 						density, c.getTotalBugs(), c.size());			}		}	}