public static boolean findPath(int[][] maze, int x, int y, int targetx, int targety) {
        // base case or exit condition : reached the target
        if(x == targetx && y == targety) {
            return true;
        } else {
            // check if x and y are in the limits && x,y does not hit a wall
            if((x >=0 && x < maze[0].length && y >=0  && y < maze.length) && maze[x][y] != 0) {
                System.out.println("x :" +x+ " y: "+ y );
                //recurse on left and right and return result of both by logical OR
                return findPath(maze, x+1,y, targetx, targety) || findPath(maze, x, y + 1, targetx, targety);
            }

        }

        return false;
    }