```
public class Solution {
public int findRadius(int[] houses, int[] heaters) {
TreeSet<Integer> treeSet=new TreeSet<>();
for (int h: heaters) treeSet.add(h);
int max=0;
for (int h: houses) {
Integer l=treeSet.floor(h), r=treeSet.higher(h);
max=Math.max(max, Math.min(l==null?Integer.MAX_VALUE:h-l, r==null?Integer.MAX_VALUE:r-h));
}
return max;
}
}
```