All pastes #768770 Raw Edit

Someone

public text v1 · immutable
·published 2007-11-10 21:40 UTC
rendered paste body
   import java.util.Scanner;
   import java.io.*;
   import javax.swing.JOptionPane;
	
    public class Satellite
   {
       public static void main(String[] args) throws FileNotFoundException
      {
         Scanner sc=new Scanner(System.in);
         System.out.print("Enter the dimensions (Rows x Cols): ");
         int x=sc.nextInt();
         int y=sc.nextInt();
         System.out.println("Enter your rows");
         String[][] field=new String[x][y];
         for(int k=0;k<x;k++)
         {
            String g=sc.next();
            for(int i=0;i<y;i++)
               field[x][y]=""+g.charAt(y);
         }
         int max=0;
			int counter=0;
         System.out.println("The biggest patch was "+ findBiggest(x,y,field,max,counter));
      }
       public static int findBiggest(int x,int y, String[][] field,int max,int counter)
      {
         if(field[x][y].equals("."))
            counter=0;
         else
         {
            counter++;
            if(counter>max)
               max=counter;
            findBiggest(x+1,y,field,max,counter);
            findBiggest(x,y+1,field,max,counter);
            findBiggest(x-1,y,field,max,counter);
            findBiggest(x,y-1,field,max,counter);
         }
			return max;			
      }
   }