sobota, 20 września 2014

java - how to check execution time.

package practice;

public class dateTime
{
    public static void main (String[] args)
    {
        long t1 = System.currentTimeMillis();       
//something complicated
        for (int i =0; i<1E6; i++)
        {
            double x = Math.pow(Math.random(), Math.random());
        }
//end operation
        long t2 = System.currentTimeMillis();
        System.out.println((t2-t1)/1000.0 + " sec ");
       
    }
}

Brak komentarzy:

Prześlij komentarz