What you're currently doing here is a micro benchmark. This is not an easy task, because you have to take into account all these tips: How do I write a correct micro-benchmark in Java?.
Still, there's no need to reinvent the wheel. There are frameworks that ease this work like JUnitBenchmarks and Caliper that help you to perform real benchmarks for your pieces of code/algorithms by using JUnit tests.