Joreto

Benchmark Program

Mar 19th, 2023
473
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.45 KB | Gaming | 0 0
  1. public class JoRoExAms {
  2.     public static void main(String[] args) {
  3.  
  4.  
  5.      long startTime = System.currentTimeMillis();
  6.      long endTime = startTime + 60000;
  7.  
  8.      long index = 0;
  9.  
  10.      while (true) {
  11.          double x =Math.sqrt(index);
  12.          long now = System.currentTimeMillis();
  13.          if (now > endTime) {
  14.              break;
  15.          }
  16.          index++;
  17.      }
  18.         System.out.println(index + " loops in one minute.");
  19.  
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment