title: Execution time and process time fluctuation
body: <p>Why there is fluctuation in execution and process CPU time vary every time i run the below code in Netbeans. Does my CPU usage also vary every time. And how do I find CPU usage for the below code.</p>
  
  <pre><code>class test{
  static com.sun.management.OperatingSystemMXBean mxbean = (com.sun.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
  
  public static void main(String[] args) throws InterruptedException {
  
  
          long start1 = System.currentTimeMillis();
          long pstart1 = mxbean.getProcessCpuTime();
          long pstart2 = TimeUnit.MILLISECONDS.convert(pstart1, TimeUnit.NANOSECONDS);        
  
      for (int i = 0; i &lt; 10000; i++) {    
  
              System.out.println("hello");
  
      }     
  
          long end1 = System.currentTimeMillis();
          long pend1 = mxbean.getProcessCpuTime();
          long pend2 = TimeUnit.MILLISECONDS.convert(pend1, TimeUnit.NANOSECONDS);
          float pdif = pend2 - pstart2;
          float edif = end1 - start1;
  
          System.out.println(edif);
          System.out.println(pdif);
  
  }
  }
  </code></pre>