```
if(matrix==null || matrix.length==0 || matrix[0].length==0 || matrix[0][0]>target) return false;
int idx = Arrays.binarySearch(matrix, new int[]{target}, (a,b) -> a[0]-b[0]);
if(idx>=0) return true;
return Arrays.binarySearch(matrix[-idx-2], target)>=0;
```