title: How do I write a correct micro-benchmark in Java?
body: <p>How do you write (and run) a correct micro-benchmark in Java?</p>
  
  <p>I'm looking for some code samples and comments illustrating various things to think about.</p>
  
  <p>Example: Should the benchmark measure time/iteration or iterations/time, and why?</p>
  
  <p>Related: <a href="https://stackoverflow.com/questions/410437/is-stopwatch-benchmarking-acceptable">Is stopwatch benchmarking acceptable?</a></p>