public class ProfileTest { static int numTrials; // The number of trials to use in averaging. static int size; // Data (array) size. static int[] data; // The data. // Find partial maximum: the max value in data[0],...,data[limit]. static int findMax (int limit) { int max = data[0]; for (int i=1; i max) max = data[i]; return max; } // Find partial sum: the sum of data[0],...,data[limit]. static double findSum (int limit) { double sum = 0; for (int i=0; i "); System.exit(1); } // Obtain the size of the data. size = Integer.parseInt (argv[0].trim()); // Obtain the number of trials used in averaging. numTrials = Integer.parseInt (argv[1].trim()); // Create random data. createData (); // Estimate the average partial-maximum. estimateMax (); // Estimate the average partial-sum. estimateSum (); } catch (Exception e) { e.printStackTrace(); } } }