FileDocCategorySizeDatePackage
CastTest.javaAPI DocExample1433Mon Feb 14 15:38:06 GMT 2000tuning.exception

CastTest

public class CastTest extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)


        Integer i = new Integer(3);
	Integer q = (Integer) i;
        System.out.println(q);

        int REPEAT = (args.length == 0) ? 500000000 : Integer.parseInt(args[0]);
	Integer res;
        long time = System.currentTimeMillis();
        for (int j = REPEAT; j > 0 ; j--)
            res = test1(i);
        time = System.currentTimeMillis() - time;
        System.out.println("test1(i) took " + time);

        time = System.currentTimeMillis();
        for (int j = REPEAT; j > 0 ; j--)
            res = test2(i);
        time = System.currentTimeMillis() - time;
        System.out.println("test2(i) took " + time);

        time = System.currentTimeMillis();
        for (int j = REPEAT; j > 0 ; j--)
            res = test2(i);
        time = System.currentTimeMillis() - time;
        System.out.println("test2(i) took " + time);

        time = System.currentTimeMillis();
        for (int j = REPEAT; j > 0 ; j--)
            res = test1(i);
        time = System.currentTimeMillis() - time;
        System.out.println("test1(i) took " + time);
    
public static java.lang.Integertest1(java.lang.Object o)

        Integer i = (Integer) o;
        return i;
    
public static java.lang.Integertest2(java.lang.Integer o)

        Integer i = (Integer) o;
        return i;