public class RuntimeTest
{
    public RuntimeTest(int n, int m)
    {
        
        long iff = 0, mod = 0 , bit = 0;
        for(int i = 0 ; i < m; i++)
        {
            mod += RuntimeTestMod(n);
            bit += TestRuntime(n);
            iff += RuntimeTestIf(n);
        }

        double executions = n * m;

        System.out.println("if statement average: " + (iff / executions));
        System.out.println("modulo average: " + (mod / executions));
        System.out.println("bitwise and average: " + (bit / executions));
    }
    public RuntimeTest()
    {
        this(10000, 10000);
    }
    public static long TestRuntime(int n)
    {
        long start = System.nanoTime();
        
        for(int i = 0; i < n; i++)
        {
            Testat.apply(new int []{1,2,3,4,5,6}, 7);
            Testat.apply(new int[]{1,2,3,3,4,5}, 3);
            Testat.apply(new int[]{1,2,3,4,5}, -3 );
            Testat.apply(new int[]{1,2,3}, 0 );
            Testat.apply(new int[]{1,2}, 7 );
            Testat.apply(new int[]{1}, 5 );
            Testat.apply(new int[]{}, 2 );
        }
        
        return (System.nanoTime() - start);
    }
    public static long RuntimeTestMod(int n)
    {
        long start = System.nanoTime();
        
        for(int i = 0; i < n; i++)
        {
            Testat.applymod(new int []{1,2,3,4,5,6}, 7);
            Testat.applymod(new int[]{1,2,3,3,4,5}, 3);
            Testat.applymod(new int[]{1,2,3,4,5}, -3 );
            Testat.applymod(new int[]{1,2,3}, 0 );
            Testat.applymod(new int[]{1,2}, 7 );
            Testat.applymod(new int[]{1}, 5 );
            Testat.applymod(new int[]{}, 2 );
        }
        
        return (System.nanoTime() - start);
    }
    public static long RuntimeTestIf(int n)
    {
        long start = System.nanoTime();
        
        for(int i = 0; i < n; i++)
        {
            Testat.applyif(new int []{1,2,3,4,5,6}, 7);
            Testat.applyif(new int[]{1,2,3,3,4,5}, 3);
            Testat.applyif(new int[]{1,2,3,4,5}, -3 );
            Testat.applyif(new int[]{1,2,3}, 0 );
            Testat.applyif(new int[]{1,2}, 7 );
            Testat.applyif(new int[]{1}, 5 );
            Testat.applyif(new int[]{}, 2 );
        }
        
        return (System.nanoTime() - start);
    }

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