Replace inlined string allocations to loop in 096-array-copy-concurrent

Replacing inlined string allocations with a loop is expected to reduce
the number of GC invocations in case of GC-stress mode. Hopefully, this
will fix the timeout that is being observed.

Bug: 169242013
Test: art/test/testrunner/testrunner.py --host -t 096-array-copy-concurrent
Change-Id: Ib5c4130a5369749f1c28496cc2a1849f776a45be
diff --git a/test/096-array-copy-concurrent-gc/src/Main.java b/test/096-array-copy-concurrent-gc/src/Main.java
index 3cf791a..eddde11 100644
--- a/test/096-array-copy-concurrent-gc/src/Main.java
+++ b/test/096-array-copy-concurrent-gc/src/Main.java
@@ -44,6 +44,15 @@
 
     Object [] array = new Object[8000];
 
+    void allocateFourStrings() {
+      for (int i = 0; i < 4; i++) {
+        String str = new String("Creating some garbage" + Math.random());
+        if (str.length() < 22) {
+          System.out.println("bad length");
+        }
+      }
+    }
+
     void stressArray(boolean doLog) {
         // We want many references in the array
         // We also want elements close to each other to have large
@@ -63,20 +72,14 @@
             Object obj = array[array.length - 1];
             System.arraycopy(array, 0, array, 1, array.length - 1);
             array[0] = obj;
-            new String("Creating some garbage" + Math.random());
-            new String("Creating some garbage" + Math.random());
-            new String("Creating some garbage" + Math.random());
-            new String("Creating some garbage" + Math.random());
+            allocateFourStrings();
         }
 
         for (int j = 0; j < array.length; j++) {
             Object obj = array[0];
             System.arraycopy(array, 1, array, 0, array.length - 1);
             array[array.length - 1] = obj;
-            new String("Creating some garbage" + Math.random());
-            new String("Creating some garbage" + Math.random());
-            new String("Creating some garbage" + Math.random());
-            new String("Creating some garbage" + Math.random());
+            allocateFourStrings();
         }
 
         if (doLog) {