Switch to full style
General Java code examples
Post a reply

Calculate process time

Tue Nov 11, 2008 11:44 pm

Code:
import java.util.*;

public class 
CalculateProcessTime{
  public static 
void main(String[] args){
    
int repeat 2000;
    
double[] ds = {Double.MAX_VALUE, -3.14e-200DDouble.NEGATIVE_INFINITY567.89023D,
123e199D, -0.000456D, -1.234D1e55D};
    
long[] ls = {2283911683699007717L, -8007630872066909262L4536503365853551745L,
548519563869L45LLong.MAX_VALUE1L, -9999L7661314123L0L};
    
long time;
    
StringBuffer s = new StringBuffer();
    
Hashtable<Object,Object= new Hashtable<Object,Object>();
    
System.out.println("Starting test");
    
time System.currentTimeMillis();
    for(
int i repeat0i--){
      
s.setLength(0);
      for(
int j ds.length-1>= 0j--){
        
s.append(ds[j]);
        
h.put(new Double(ds[j]), Boolean.TRUE);
      }
      for(
int j ls.length-1>= 0j--){
        
s.append(ls[j]);
        
h.put(new Long(ls[j]), Boolean.FALSE);
      }
    }
    
time System.currentTimeMillis() - time;
    
System.out.println(" The test took " time " milliseconds");
  }


calculate the process time of the completion of the operation through the Java program. In this section, an example with the complete code of the program is given for the best illustration of the procedure of calculating the process time in which any type of operation is completed after whole processing.
8)



Post a reply
  Related Posts  to : Calculate process time
 calculate the load time for a page     -  
 process we can used complete and uncomplete method     -  
 code for FIFO schedualing process     -  
 Calculate score of the student     -  
 How to Calculate Volume of a Rectangle     -  
 Calculate euclidean distances     -  
 Calculate the sum of values in an array     -  
 calculate speed of a car in javaCV     -  
 calculate sum of many text inputs in javascript     -  
 calculate data from multiple selection     -  

Topic Tags

Java Time