added the main method in avgKTerms.java