Sometimes it is useful to measure how much time a function takes. This can be done using following code:

Java Code:
long startTime = System.currentTimeMillis();

// call function
obj.callFunction();

long endTime = System.currentTimeMillis();
long timeDifference = endTime - startTime;