// Region test: allocate arbitrary size titanium array class Test1 { public static void main(String[] args) throws RegionInUse { int total = 0; int iters = Integer.parseInt(args[0]); for (int n = iters; n > 0; n--) { PrivateRegion r = new PrivateRegion(); int k = Integer.parseInt(args[1]); int l = Integer.parseInt(args[2]); int[1d] arr = new(r) int[1 : l]; foreach (p in arr.domain()) arr[p] = k; total += sum(arr); r.delete(); } System.out.println(args[0] + " x " + args[1] + " x " + args[2] + " = " + total); } static int sum(int[1d] a) { int sum = 0; foreach (p in a.domain()) sum += a[p]; return sum; } }