Below is my variation of this benchmark. There are overloaded integer and floating point versions of the Tak method. Integer is used by . If the -f flag is given on the command line, the floating point method is used. The number of passes to make may also be entered from the command line. If it is not, 1000 passes are made. The Java Date class is used to time that part of the test where the benchmarking is done.

import java.util.Date; public class Tak { public static void main(String[] args) { boolean useFloat = false; int numpasses; for (int i = 0; i < args.length; i++) { if (args[i].startsWith(-f)) useFloat = true; } try { numpasses = Integer.parseInt(args[args.length-1]); } catch (Exception e) { numpasses = 1000; } Date d1, d2; if (useFloat) { d1 = new Date(); for (int i = 0; i < numpasses; i++) { Tak(18.0f, 12.0f, 6.0f); } d2 = new Date(); } else { d1 = new Date(); for (int i = 0; i < numpasses; i++) { Tak(18, 12, 6); } d2 = new Date(); } long TimeRequired = d2.getTime() - d1.getTime(); double numseconds = TimeRequired/1000.0; System.out.println("Completed + numpasses + passes in + numseconds + seconds); System.out.println(numpasses/numseconds + calls per second); } public static int Tak(int x, int y, int z) { if (y = x) return z; else return Tak(Tak(x-1, y, z), Tak(y-1, z, x), Tak(z-1, x, y)); } public static float Tak(float x, float y, float z) { if (y = x) return z; else return Tak(Tak(x-1.0f, y, z), Tak(y-1.0f, z, x), Tak(z-1.0f, x, y)); } }

Bhopal news
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100

freelance web designer india ecommerce web developer | Ecommerce web design, software developer india | Web hosting India Windows hosting | India web hosting Windows hosting India | India software developer | web designer india