Yes.
Try
long beginningTime = System.currentTimeMillis();
//*****************
RUN YOUR ALGORITHM
//*****************
long finishedTime = System.currentTimeMillis();
long difference = finishedTime - beginningTime;
Here is where I found the method.
http://java.sun.com/j2se/1.4.2/docs/api/java/lang/System.html