To get a method's execution time use:
long startTime = System.nanoTime();
long endTime = System.nanoTime();
long duration = (endTime - startTime); //divide by 1000000 to get milliseconds.
Of course, the warnings about using the wall clock apply: influences of JIT-compilation, multiple, etc. Thus, you need to first execute the method a lot of times first, such that the JIT compiler does its work, and then recur this test various times and take the lowest execution time