// return index and value static Pair minOfIntArray_withIndex(int[] a) { if (a == null || a.length == 0) null; int n = a.length, x = a[0], best = 0; for (int i = 1; i < n; i++) { int y = a[i]; if (y < x) { x = y; best = i; } } ret pair(best, x); }