Work counter in Java language