<awangdev>Search a 2D Matrix_1.java
public boolean searchMatrix(int[][] matrix, int target) {
        if (matrix == null || matrix.length == 0 || matrix[0].length == 0) {
            return false;
        }
        int row = matrix.length;
        int col = matrix[0].length;
        int start = 0;
        int end = row * col - 1;
        int mid;

        while (start + 1 < end) {
            mid = start + (end - start)/2;
            int num = matrix[mid/col][mid%col];
            if (target == num) {
                return true;
            } else if (num < target) {
                start = mid;
            } else {
                end = mid;
            }
        }

        return (matrix[start/col][start%col] == target || matrix[end/col][end%col] == target);
    }
public boolean var_0 ( int [ ] [ ] var_1 , int var_2 ) {
  if ( var_1 == null || var_1 . length == 0 || var_1 [ 0 ] . length == 0 ) {
    return false ;
  }
  int var_6 = var_1 . length ;
  int var_7 = var_1 [ 0 ] . length ;
  int var_8 = 0 ;
  int var_10 = var_6 * var_7 - 1 ;
  int var_11 ;
  while ( var_8 + 1 < var_10 ) {
    var_11 = var_8 + ( var_10 - var_8 ) / 2 ;
    int var_13 = var_1 [ var_11 / var_7 ] [ var_11 % var_7 ] ;
    if ( var_2 == var_13 ) {
      return true ;
    }
    else if ( var_13 < var_2 ) {
      var_8 = var_11 ;
    }
    else {
      var_10 = var_11 ;
    }
  }
  return ( var_1 [ var_8 / var_7 ] [ var_8 % var_7 ] == var_2 || var_1 [ var_10 / var_7 ] [ var_10 % var_7 ] == var_2 ) ;
}
