Lines Matching refs:a
29 static int oneArray(int[] a) { in oneArray() argument
31 for (int i = 0; i < a.length; i++) { in oneArray()
32 x += a[i]; in oneArray()
43 static int oneArrayAbs(int[] a, int[] b) { in oneArrayAbs() argument
45 for (int i = Math.abs(b.length); i < a.length; i++) { in oneArrayAbs()
46 x += a[i]; in oneArrayAbs()
59 static int twoArrays(int[] a, int[] b) { in twoArrays() argument
61 for (int i = 0; i < Math.min(a.length, b.length); i++) { in twoArrays()
62 x += a[i] + b[i]; in twoArrays()
75 static int threeArrays(int[] a, int[] b, int[] c) { in threeArrays() argument
77 for (int i = 0; i < Math.min(Math.min(a.length, b.length), c.length); i++) { in threeArrays()
78 x += a[i] + b[i] + c[i]; in threeArrays()
92 static int fourArrays(int[] a, int[] b, int[] c, int[] d) { in fourArrays() argument
94 for (int i = 0; i < Math.min(Math.min(a.length, b.length), Math.min(c.length, d.length)); i++) { in fourArrays()
95 x += a[i] + b[i] + c[i] + d[i]; in fourArrays()
109 static int oneArrayWithCleanup(int[] a) { in oneArrayWithCleanup() argument
111 int n = Math.min(4, a.length); in oneArrayWithCleanup()
113 x += a[i]; in oneArrayWithCleanup()
115 for (int i = n; i < a.length; i++) { in oneArrayWithCleanup()
116 x += a[i] * 10; in oneArrayWithCleanup()
131 static int twoArraysWithCleanup(int[] a, int[] b) { in twoArraysWithCleanup() argument
133 int n = Math.min(a.length, b.length); in twoArraysWithCleanup()
135 x += a[i] + b[i]; in twoArraysWithCleanup()
137 for (int i = n; i < a.length; i++) { in twoArraysWithCleanup()
138 x += a[i]; in twoArraysWithCleanup()
154 static int threeArraysWithCleanup(int[] a, int[] b, int[] c) { in threeArraysWithCleanup() argument
156 int n = Math.min(a.length, Math.min(b.length, c.length)); in threeArraysWithCleanup()
158 x += a[i] + b[i] + c[i]; in threeArraysWithCleanup()
160 for (int i = n; i < a.length; i++) { in threeArraysWithCleanup()
161 x += a[i]; in threeArraysWithCleanup()
173 static int altLoopLogic(int[] a, int[] b) { in altLoopLogic() argument
175 int n = Math.min(a.length, b.length); in altLoopLogic()
177 x += a[i] + b[i]; in altLoopLogic()
189 static int hiddenMin(int[] a, int[] b) { in hiddenMin() argument
191 for (int i = 0; i < a.length && i < b.length; i++) { in hiddenMin()
192 x += a[i] + b[i]; in hiddenMin()
207 static int hiddenMinWithCleanup(int[] a, int[] b) { in hiddenMinWithCleanup() argument
210 for (; i < a.length && i < b.length; i++) { in hiddenMinWithCleanup()
211 x += a[i] + b[i]; in hiddenMinWithCleanup()
213 for (; i < a.length; i++) { in hiddenMinWithCleanup()
214 x += a[i]; in hiddenMinWithCleanup()
220 int[] a = { 1, 2, 3, 4, 5 }; in main() local
226 expectEquals(15, oneArray(a)); in main()
231 expectEquals(15, oneArrayAbs(a, e)); in main()
232 expectEquals(5, oneArrayAbs(a, d)); in main()
234 expectEquals(30, twoArrays(a, a)); in main()
235 expectEquals(49, twoArrays(a, b)); in main()
236 expectEquals(12, twoArrays(a, c)); in main()
237 expectEquals(28, twoArrays(a, d)); in main()
239 expectEquals(45, threeArrays(a, a, a)); in main()
240 expectEquals(33, threeArrays(a, b, c)); in main()
241 expectEquals(58, threeArrays(a, b, d)); in main()
242 expectEquals(28, threeArrays(a, c, d)); in main()
244 expectEquals(60, fourArrays(a, a, a, a)); in main()
245 expectEquals(49, fourArrays(a, b, c, d)); in main()
247 expectEquals(60, oneArrayWithCleanup(a)); in main()
252 expectEquals(30, twoArraysWithCleanup(a, a)); in main()
253 expectEquals(49, twoArraysWithCleanup(a, b)); in main()
254 expectEquals(21, twoArraysWithCleanup(a, c)); in main()
255 expectEquals(33, twoArraysWithCleanup(a, d)); in main()
257 expectEquals(45, threeArraysWithCleanup(a, a, a)); in main()
258 expectEquals(42, threeArraysWithCleanup(a, b, c)); in main()
259 expectEquals(63, threeArraysWithCleanup(a, b, d)); in main()
260 expectEquals(37, threeArraysWithCleanup(a, c, d)); in main()
262 expectEquals(30, altLoopLogic(a, a)); in main()
263 expectEquals(49, altLoopLogic(a, b)); in main()
264 expectEquals(12, altLoopLogic(a, c)); in main()
265 expectEquals(28, altLoopLogic(a, d)); in main()
267 expectEquals(30, hiddenMin(a, a)); in main()
268 expectEquals(49, hiddenMin(a, b)); in main()
269 expectEquals(12, hiddenMin(a, c)); in main()
270 expectEquals(28, hiddenMin(a, d)); in main()
272 expectEquals(30, hiddenMinWithCleanup(a, a)); in main()
273 expectEquals(49, hiddenMinWithCleanup(a, b)); in main()
274 expectEquals(21, hiddenMinWithCleanup(a, c)); in main()
275 expectEquals(33, hiddenMinWithCleanup(a, d)); in main()