q3fuba

loop measure with break

Aug 29th, 2016
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.32 KB | None | 0 0
  1. public class main {
  2.  
  3.     public static void main(String[] args) {
  4.         long startTime = System.nanoTime();
  5.        
  6.         for(int x = 0; x < 1234567890; x++) {
  7.             if (x == 234) {
  8.                 break;
  9.             }
  10.         }
  11.        
  12.         long duration = System.nanoTime() - startTime;
  13.         System.out.println("Execution Time: "+duration+" nanoseconds");
  14.  
  15.     }
  16.  
  17. }
Advertisement
Add Comment
Please, Sign In to add comment