Java obtient la paire la plus proche d'une somme donnée en deux tableaux

public int[] pairToTarget(int[] a, int[] b, int target) {

		Map<Integer, int[]> map = new TreeMap<>();

		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < b.length; j++) {
				int[] pair = new int[2];
				pair[0] = a[i];
				pair[1] = b[j];
				map.put(Math.abs(target - (a[i] + b[j])), pair);
			}
		}
		List<Integer> l1 = new ArrayList<>(map.keySet());

		return map.get(l1.get(0));
	}
Okin