title: Writing custom annotations in java - TimeCounter annotation example
body: <p>Basically I have a requirement to track time spent in a method using custom annotation. (I know spring AOP can be used for this, but we can not use it in our product).</p>
  <pre><code>public class TimeCounterDemo {
      
      @TimeCounter
      public void trackMyTimeSpentUsingAnnotation()
      {
          //some heavy processing stuff
      }   
  }
  
  public @interface TimeCounter {
    //need help with this implementation.
  }
  </code></pre>
  <p>So, my requirement is to complete the <code>TimeCounter</code> annotation.
  The requirement are simple -</p>
  <ol>
  <li>Log time of method start.</li>
  <li>Log time of method end.</li>
  <li>Log total time spent in method.</li>
  <li>Name of method executed</li>
  </ol>
  <p>Could someone help on how to implement this annotation to above requirements.</p>
  <p>Thanks in advance.</p>