FileDocCategorySizeDatePackage
FloatDoubleTime.javaAPI DocExample521Sat Apr 28 10:22:44 BST 2001None

FloatDoubleTime

public class FloatDoubleTime extends Object

Fields Summary
protected static final int
HOW_MANY
How many times to do the loop
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)


	     
		long t0 = System.currentTimeMillis();
		float f = 0;
		for (int i=0; i<HOW_MANY; i++)
			f *= i;
		long t1 = System.currentTimeMillis();

		double d = 0;
		for (int i=0; i<HOW_MANY; i++)
			d *= i;
		long t2 = System.currentTimeMillis();

		System.out.println("Float:  " + (t1 - t0) + " " + f);

		System.out.println("Double: " + (t2 - t1) + " " + d);