diff options
Diffstat (limited to 'src/test/java/com/seaofnodes/simple/spill/Chapter20Test-testArray1.smp')
| -rw-r--r-- | src/test/java/com/seaofnodes/simple/spill/Chapter20Test-testArray1.smp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/test/java/com/seaofnodes/simple/spill/Chapter20Test-testArray1.smp b/src/test/java/com/seaofnodes/simple/spill/Chapter20Test-testArray1.smp new file mode 100644 index 00000000..7f3bd007 --- /dev/null +++ b/src/test/java/com/seaofnodes/simple/spill/Chapter20Test-testArray1.smp @@ -0,0 +1,8 @@ +int[] !ary = new int[arg]; +// Fill [0,1,2,3,4,...] +for( int i=0; i<ary#; i++ ) + ary[i] = i; +// Fill [0,1,3,6,10,...] +for( int i=0; i<ary#-1; i++ ) + ary[i+1] += ary[i]; +return ary[1] * 1000 + ary[3]; // 1 * 1000 + 6 |
