/* * Timing.java * This class estimates the exponent of our * implementation of Karatsuba 's algorithm * and also Java's multiplication. * * @author Chee Yap * Basic Algorithms, Fall 2005 */ import java.math.*; import java.util.Random; public class Timing { //default parameters: public static int noPoints=10, stepSize=50, startSize=200, noTrials=50; public static void main(String[] args) { BigInteger X,Y,Z; int size=0; double log_Tn,log_n; switch(args.length){ case 4: noTrials=Integer.parseInt(args[3]); case 3: startSize=Integer.parseInt(args[2]); case 2: stepSize=Integer.parseInt(args[1]); case 1: noPoints=Integer.parseInt(args[0]); break; default: System.out.println("NOTE: DEFAULT values are being used"); } Random rnd = new Random (); double [] x_arr= new double [noPoints]; //holds log_n values double [] y_arr= new double [noPoints]; //holds log_Tn values double [] results = new double [2]; for(int i=0;i