--- jsr166/src/test/loops/FinalLongTest.java 2005/05/09 19:33:30 1.2 +++ jsr166/src/test/loops/FinalLongTest.java 2015/01/15 18:34:19 1.8 @@ -1,13 +1,13 @@ /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ public class FinalLongTest { static int npairs = 2; static int iters = 10000000; - static int LEN = 2; + static int LEN = 2; static final Long[] nums = new Long[LEN]; static volatile boolean done; static volatile long total; @@ -15,7 +15,6 @@ public class FinalLongTest { static Long n1 = new Long(22); static Long n2 = new Long(23); static Long n3 = new Long(23); - public static void main(String[] args) { for (int i = 0; i < LEN; ++i) @@ -32,7 +31,7 @@ public class FinalLongTest { } } - static long nextRandom(long seed) { + static long nextRandom(long seed) { return (seed * 0x5DEECE66DL + 0xBL) & ((1L << 48) - 1); } @@ -47,12 +46,12 @@ public class FinalLongTest { Long[] ns = nums; while (n-- > 0) { - // int k = (int)(s & (LEN-1)); + // int k = (int) (s & (LEN-1)); // if (k < 0 || k >= LEN) k = 1; // int l = (k+1) & (LEN-1); // if (l < 0 || l >= LEN) l = 0; - // int k = (s & 1) == 0? 0 : 1; - // int l = (k == 0)? 1 : 0; + // int k = (s & 1) == 0 ? 0 : 1; + // int l = (k == 0) ? 1 : 0; if ((s & (LEN-1)) == 0) { n3 = n1; n0 = new Long(s); @@ -78,7 +77,7 @@ public class FinalLongTest { int n = iters; long s = initialSeed(this); while (s != 0 && n > 0) { - long nexts; // = nums[(int)(s & (LEN-1))].longValue(); + long nexts; // = nums[(int) (s & (LEN-1))].longValue(); if ((s & (LEN-1)) == 0) nexts = n0.longValue(); else @@ -90,7 +89,7 @@ public class FinalLongTest { nexts = n3.longValue(); } - if (nexts != s) + if (nexts != s) --n; else if (done) break; @@ -98,7 +97,7 @@ public class FinalLongTest { } done = true; total += s; - if (s == 0) + if (s == 0) throw new Error("Saw uninitialized value"); } }