// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
public class DivShift {
   // main program
   public static void main(String[] args) throws Exception {
      long tmp;
      // nothing
      tmp = 0;
      Benchmark.start("Nothing");
      for(int j=0;j<10000;j++) {
         for(int i=0;i<1000000;i++) {
            tmp = tmp + i;
         }
      }
      Benchmark.end();
      System.out.println(tmp);
      // time division
      tmp = 0;
      Benchmark.start("Division");
      for(int j=0;j<10000;j++) {
         for(int i=0;i<1000000;i++) {
            tmp = tmp + (i/256);
         }
      }
      Benchmark.end();
      System.out.println(tmp);
      // time shift
      tmp = 0;
      Benchmark.start("Shift");
      for(int j=0;j<10000;j++) {
         for(int i=0;i<1000000;i++) {
            tmp = tmp + (i>>8);
         }
      }
      Benchmark.end();
      System.out.println(tmp);
   }
}
