Java tutorial
//package com.java2s; import java.util.HashMap; public class Main { public static void putSumInClass(HashMap<String, Integer> suminclass, String text) { int i = 0, index; String info = text; while ((index = info.indexOf("//@")) > 0) { i++; info = info.substring(index + 2); } if (suminclass.get(Integer.toString(i)) == null) { suminclass.put(Integer.toString(i), 1); } else { suminclass.put(Integer.toString(i), suminclass.get(Integer.toString(i)) + 1); } } }