long start = System.currentTimeMillis(); class.method(); long time = System.currentTimeMillis() - start;