public int countTotalLines(File directory) throws Exception {
		if(directory==null){
			return 0;
		}
		if (!directory.isDirectory() || !directory.exists()) {
			throw new Exception("ĲǴڵļ!");
		}
		//ջĿ¼
		Stack<File> stack = new Stack<File>();
		stack.push(directory);
		int count = 0;
		File[] files;
		do {
			files = stack.pop().listFiles();
			for (File file : files) {
				if (file.isDirectory()) {
					stack.push(file);
				} else {
					if (file.getName().endsWith(".java")) {
						count += FileUtil.countLines(file);
					}
				}
			}
		} while (!stack.isEmpty());
		return count;
	}