public boolean searchMatrix(int[][] matrix, int target) {
        if (matrix == null) {
            return false;
        }

        int row = matrix.length;
        int column = matrix[0].length;
        /**
         * from the first, the end of the row. the situation for the loop is set inside the loop
         */
        for (int i = 0, j = column - 1; i < row && j >= 0; ) {
            if (target == matrix[i][j]) {
                return true;
            } 
            //search in the row from the end 
            else if (target < matrix[i][j]) {
                j = j - 1;
            } 
            //search the particular row
            else if (target > matrix[i][j]) {
                i = i + 1;
            }
        }
        return false;
    }