long start = System.currentTimeMillis();
/* code you want to time, here */
long duration = System.currentTimeMillis() - start;