title: error java.lang.ArrayIndexOutOfBoundsException
body: <p>I am having table stored in database i am trying to retrieve all data in it
  Why i get this error when i tried to retrieve all records in my database? 
  <code>Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 185
      at warsh01.selectStmt01.getObjectIDsFromDB(selectStmt01.java:83)</code></p>
  
  <pre><code>  public static int[] getObjectIDsFromDB (String Dbnum) throws SQLException{
      String selectSQL = "SELECT ID FROM " + Dbnum +.tabName ";
           dbConnection = getDBConnection();
           preparedStatement = dbConnection.prepareStatement(selectSQL);
           ResultSet rs = preparedStatement.executeQuery();  
              rs.last();
              int[] rsIds=new int[rs.getRow()];
              rs.beforeFirst();
              int counter = 1;
              while (rs.next()) {
              rsIds[counter]=rs.getInt(1);
              counter++; // the error is pointing in this line 
              }
               return  rsIds;
        }
  </code></pre>
  
  <p>in the main method when i tried to run it i got the above exception </p>
  
  <pre><code> int [] IdsArray ;
      pathIdsArray = getObjectIDsFromDB ("za");
     List&lt;ObjClass&gt;  objItm=new ArrayList&lt;&gt;();
     for (int i = 1; i &lt; IdsArray.length; i++) {
      Item1 = new ObjClass ();
      objectItem1.color=Color.blue;
      objectItem1.LoadFromDB("za", IdsArray[i]);       
      objItm.add(Item1);
      }
  </code></pre>