Fix potential race condition with threads array.

Rationale:
Array should be filled with threads prior to first fork,
since only in that case does Java memory model ensure
all threads have consistent view of array, which itself is
subject to one test.

BUG=27805463

Change-Id: I28f1eb8461842217ced2255062d2135ef880e7d5
diff --git a/test/004-checker-UnsafeTest18/src/Main.java b/test/004-checker-UnsafeTest18/src/Main.java
index c50613d..282f9ce 100644
--- a/test/004-checker-UnsafeTest18/src/Main.java
+++ b/test/004-checker-UnsafeTest18/src/Main.java
@@ -133,6 +133,10 @@
   private static void fork(Runnable r) {
     for (int i = 0; i < 10; i++) {
       sThreads[i] = new Thread(r);
+    }
+    // Start the threads only after the full array has been written with new threads,
+    // because one test relies on the contents of this array to be consistent.
+    for (int i = 0; i < 10; i++) {
       sThreads[i].start();
     }
   }