Алгоритм Данилы
int[] array1 = new int[5];
int[] array2 = new int[10];
int a = array1[0] + array2[0];
int limit = 3;
int iPosition = 0;
int jPosition = 0;
for (int i = 0; i < array1.length; i++) {
for (int j = 0; j < array2.length; j++) {
int sum = array1[i] + array2[j];
iPosition = i;
jPosition = j;
if(limit < sum && sum < a || a < sum && sum < limit){
a = sum;
}
}
}