start of new file
[IRC.git] / Robust / src / Tests / Prefetch / ArrayTest.java
1 public class ArrayTest {
2     Item x;     
3     public ArrayTest() {
4     }
5     
6     public static void main(String[] args) {
7         ArrayTest[] n=new ArrayTest[10];
8         for(int i=0;i<10;i++) {
9             n[i]=new ArrayTest();       
10             n[i].x=new Item();
11             n[i].x.i=new Integer(10);
12         }
13         addItems(n);
14     }
15     
16     public static int addItems(ArrayTest [] array) {
17         int sum=0;
18         for(int i=0;i<array.length;i++) {
19             ArrayTest a=array[i];
20             int x=a.x.i.intValue();
21             if (i%2!=0) {
22                 sum=sum+x;
23             }
24         }
25         System.printString("Sum =");
26         System.printInt(sum);
27         System.printString("\n");
28         return sum;
29     }
30 }
31
32 public class Item {
33     Integer i;
34     public Item() {
35         
36     }
37
38 }