@@ -0,0 +1,1156 @@
+package edu.ntnu.idi.goldfish;%0A%0Aimport java.util.HashMap;%0Aimport java.util.concurrent.TimeUnit;%0A%0Apublic class StopWatch %7B%0A%09%0A%09protected static HashMap%3CString, Long%3E starts = new HashMap%3CString,Long%3E();%0A%09protected static HashMap%3CString, Long%3E timings = new HashMap%3CString,Long%3E();%0A%09%0A%09%0A%09public static void start(String name) %7B%0A%09%09timings.remove(name);%0A%09%09starts.put(name, System.currentTimeMillis());%0A%09%7D%0A%09%0A%09public static void stop(String name) %7B%0A%09%09if(!starts.containsKey(name)) %7B%0A%09%09%09System.err.format(%22have no start timing for %25s%5Cn%22, name);%0A%09%09%09return;%0A%09%09%7D%0A%09%09if(!timings.containsKey(name)) %7B%0A%09%09%09timings.put(name, System.currentTimeMillis() - starts.get(name));%09%09%09%0A%09%09%7D%0A%09%7D%0A%09%0A%09public static String str(String name) %7B%0A%09%09stop(name);%0A%09%09long time = timings.get(name);%0A%09%09return String.format(%22%25d min, %25d sec%22, %0A%09%09%09    TimeUnit.MILLISECONDS.toMinutes(time),%0A%09%09%09    TimeUnit.MILLISECONDS.toSeconds(time) - %0A%09%09%09    TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(time))%0A%09%09);%0A%09%7D%0A%09%0A%09public static void print(String name) %7B%0A%09%09System.out.format(%22%25s: %25s%5Cn%22, name, str(name));%0A%09%7D%0A%09%0A%09public static long get(String name) %7B%0A%09%09stop(name);%0A%09%09return timings.get(name);%0A%09%7D%0A%7D%0A

Create StopWatch class to ease code timing.