Please help here, kindly review my code

Scanner scn = new Scanner(System.in);

	int n = scn.nextInt();
	int m = scn.nextInt();
	int k = scn.nextInt();
	int s = scn.nextInt();

	char[][] a = new char[n][m];

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {

			a[i][j] = scn.next().charAt(0);

		}
	}
	
	for(char[] bc:a ) {
		System.out.println(bc);
	}

	 LostMagicalPark(a,n,m,k,s);

	

}

static void LostMagicalPark(char[][] a,int n, int m, int k, int s) {

	int result = s;

System.out.println(a.length);
for (int i = 0; i < n ; i++) {
for (int j = 0; j < m ; j++) {

			char ch = a[i][j];

			if (ch == '.') {
				result = result - 2;
				
				if(j<a.length-1)
				result--;
			}

			else if (ch == '*') {
				result = result + 5;
				
				if(j<a.length-1)
				result--;
			}

			else if (ch == '#') {
			if(i<n-1) {
				i++;
				j = 0;}
			else {
				break;
			}
			}

		}

	}

	if(result>=k) {
		
		System.out.println("Yes");
		System.out.println(result);
		
	}

}

}

public static void main(String args[])
{
Scanner scn = new Scanner(System.in);

	int n = scn.nextInt();
	int m = scn.nextInt();
	int k = scn.nextInt();
	int s = scn.nextInt();

	char[][] a = new char[n][m];

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {

			a[i][j] = scn.next().charAt(0);

		}
	}
	
	for(char[] bc:a ) {
		System.out.println(bc);
	}

	 LostMagicalPark(a,k,s);

	

}

 public static void LostMagicalPark(char[][] arr, int k, int s) {

        boolean flag = false;
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr[0].length; j++) {

                char ch = arr[i][j];

                if (s < k) {
                    flag = true;
                    break;
                }

                if (ch == '*') {
                    s += 5;
                } else if (ch == '.') {
                    s -= 2;
                } else {
                    break;
                }
                if (j != arr[0].length - 1)
                    s--;

            }
        }

        if (!flag) {
            System.out.println("Yes");
          System.out.println(s);
        } else {
            System.out.println("No");
        }

    }
	}

hope this will help u
pls rate my work

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.