public static void finished() { //start date Date date = new Date(); long startDate = date.getTime(); synchronized (lock4) { while (Spider.currentThreads > 0) { try { lock4.wait(); } catch(InterruptedException e) { System.out.println("Cannot wait!"); } } //end time System.out.println("FINISHED!!! woot woot!"); long endDate = date.getTime(); System.out.println(endDate - startDate); } }