title: Array count logic error
body: <p>Made some edits to the code to try and figure out why my X's [-1] are not being included in finding my average for that row. That is throwing of my averages. Any idea why It is not counting my -1's?</p>
  
  <p>output[expected]:</p>
  
  <pre><code>USER INPUT: 3
  O O O 
  X X X
  X X X 
  
  TOTAL OPENNESS OF [I][J] = 1
  TOTAL OPENNESS OF [I][J+1] = 2
  TOTAL OPENNESS OF [I][J+2] = 1
  TOTAL SUM AVERAGE FOR THAT ROW = 1.3
  HOWEVER..FOR ROW 2 AND ROW 3 
  TOTAL SUM AVERAGE FOR THOSE ROWS = 0  
  WHICH IS INCORRECT IT SHOULD = -1
  </code></pre>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>public static void openfactor(char[][] mazeValue, int n){
  
         for(int i = 1; i&lt;=n; i++)
         {  
             double rowAvg=0;
             double totalRowAvg=0;
             for(int j=1;j&lt;=n;j++)
            {
  
                int count=0;
                int totalOpeness=0;
                int totalRowOpeness = 0;
                //double rowAvg=0;
  
                 if(mazeValue[i][j]=='X'){
                     System.out.println("tHIS IS AN X FOR : [" + i + "]" +"[" + j + "] IS -1 ");
                     count = -1;
                 }
  
                else 
                 {
                 //YOU NEED TO VERIFY THAT J IS NOT OUT OF BOUND
                 if( j-1&gt;=1)
                      {
                 if(mazeValue[i][j-1]=='O')
                          count++;
                      }
                        // System.out.println("cout: "+count);
  
                      if(i-1&gt;=1 &amp;&amp; j-1&gt;=1)
                      {
                      if(mazeValue[i-1][j-1]=='O')
                          count++;
                      }
                       //  System.out.println("cout: "+count);
                       if(i-1&gt;=1)
                      {
                      if(mazeValue[i-1][j]=='O')
                          count++;
                       }
                      //   System.out.println("cout: "+count);
                      if(j+1&lt;=n)
                      {
                      if(mazeValue[i][j+1]=='O')
                          count++;
                      }
                       //  System.out.println("cout: "+count);
                      if(j+1&lt;=n &amp;&amp; i+1&lt;=n)
                      {
                      if(mazeValue[i+1][j+1]=='O')
                          count++;
                      }
                      if (i+1&lt;=n)
                      {
                      if(mazeValue[i+1][j]=='O')
                          count++;
                      }
                      //   System.out.println("cout: "+count);
                      if(j-1&gt;=1 &amp;&amp; i+1&lt;=n)
                      {
                      if(mazeValue[i+1][j-1]=='O')
                          count++;
                      }
                      if(i-1&gt;=1 &amp;&amp; j+1&lt;=n)
                      {
                      if(mazeValue[i-1][j+1]=='O')
                          count++;
                      }
                       //  System.out.println("cout: "+count);
              totalOpeness = totalOpeness +count;
              System.out.println("TOTAL OPENESS FOR : [" + i + "]" +"[" + j + "]  IS " +totalOpeness);
              totalRowOpeness = totalRowOpeness + totalOpeness;
              //}//eND OF iF CONDITION\
              }
                 
              rowAvg = (double)totalRowOpeness/(double)n;
              System.out.println("ROW AVERAGE: "+rowAvg);
              totalRowAvg = totalRowAvg + rowAvg;
              System.out.println("SUM ROW AVERAGE: "+totalRowAvg);
           }
          System.out.println("TOTAL SUM ROW AVERAGE: " +totalRowAvg);
        }
     }
      public static void printMaze(char mazeValue[][]) {
      System.out.println("MAZE");
      for (int i = 1; i &lt; mazeValue.length; i++) {
          for (int j = 1; j &lt; mazeValue[i].length; j++) {
              System.out.printf("%5c", mazeValue[i][j]);
          }
          System.out.printf("\n");
      }
    }
    public static void main(String[] args) {
      // TODO code application logic here
      Scanner kbd = new Scanner(System.in);
      System.out.println("ENTER A SINGLE INTEGER: ");
      int n = kbd.nextInt();
      char[][] mazeValue = new char[n + 1][n + 1];
      System.out.println("ENTER A PATH: ");
      for (int i = 0; i &lt; mazeValue.length; i++) {
          for (int j = 0; j &lt; mazeValue[i].length; j++) {
              if (i == 0 || j == 0 || i == n + 1 || j == n + 1)
                  mazeValue[i][j] = 'X';
              else {
                  mazeValue[i][j] = kbd.next().charAt(0);
              }
          }
      }
      printMaze(mazeValue);
      horizontalPath(mazeValue, n);
      System.out.println(" ");
      verticalPath(mazeValue,n);
      System.out.println(" ");
      openfactor(mazeValue, n);
   }
  }</code></pre>
  </div>
  </div>
  </p>