date - how to find the total time taken for a process in Java -
i have 2 java date time values , want know total time taken process.
private static date crawlstartdate,crawlenddate,totalcrawltime;
how can that? time format yyyymmddhhmmss
thanks
you can try one..
public static void main(string[] argv) { long lstarttime = new date().gettime(); // start time createarray(); // tasks eat time long lendtime = new date().gettime(); // end time long difference = lendtime - lstarttime; // check different system.out.println("elapsed milliseconds: " + difference); } public static void createarray() { try { thread.sleep(2000); } catch (interruptedexception e) { e.printstacktrace(); } string sarray[] = new string[1000000]; (int = 0; < 1000000; i++) sarray[i] = "array " + i; }
Comments
Post a Comment