--- jsr166/src/test/loops/FinalLongTest.java 2005/05/02 19:19:38 1.1 +++ jsr166/src/test/loops/FinalLongTest.java 2011/03/15 19:47:05 1.6 @@ -1,3 +1,8 @@ +/* + * 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/publicdomain/zero/1.0/ + */ public class FinalLongTest { static int npairs = 2; @@ -10,7 +15,7 @@ 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) @@ -27,7 +32,7 @@ public class FinalLongTest { } } - static long nextRandom(long seed) { + static long nextRandom(long seed) { return (seed * 0x5DEECE66DL + 0xBL) & ((1L << 48) - 1); } @@ -42,12 +47,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); @@ -73,7 +78,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 @@ -85,7 +90,7 @@ public class FinalLongTest { nexts = n3.longValue(); } - if (nexts != s) + if (nexts != s) --n; else if (done) break; @@ -93,7 +98,7 @@ public class FinalLongTest { } done = true; total += s; - if (s == 0) + if (s == 0) throw new Error("Saw uninitialized value"); } }