package performance;

public class Obsah {

    public static double obsah(double r) {
        return 3.141592 * r * r;
    }

    public static void test() {
        double d = 0.0;
        long start = System.nanoTime();
        while (d < 10000000.0) {
            d += 0.1;
        }
        long end = System.nanoTime();
        long ms = (end - start) / 1000000;
        System.out.println("empty loop: " + ms + "ms");
        d = 0.0;
        start = System.nanoTime();
        while (d < 10000000.0) {
            d += 0.1;
            obsah(d);
        }
        end = System.nanoTime();
        ms = (end - start) / 1000000;
        System.out.println("time: " + ms + "ms");
    }

    public static void main(String[] args) {
        test();
        test();
    }
}

