title: Array of Lists(Int, Int)
body: <p>As you'll see, I'm fairly new to object oriented programming. I'm trying to teach myself, but am stuck on this and can't figure out what to do.</p>
  
  <p>I'm trying to write some code to layout a rectangular grid into rows and columns. Think "laying out small squares onto a large rectangle". The user will input how many of the "small squares" they have. My goal is to map this integer into the best layout of rows and column.</p>
  
  <p>The user can input any integer from 20 through 100. For each of the 81 different possible entries, I have determined the best way to layout these small squares in rows and columns. What I need to do now is to get these 81 different layouts into my program then identify and return the one that applies to the user's input.</p>
  
  <p>Since there are only 81 values and they range through consecutive integers, I think that an array is the best idea (rather than a map, hashmap, vector, etc.). Here's what I have thus far. It's a bit of a mess, but I think you'll get the idea of what I'm trying to do. Can anyone help me? I can't seem to return the row and column values that I need.</p>
  
  <p>Thank you!</p>
  
  <pre><code>public static void getLayout (int numSquares) {
  
      int rows;
      int columns;        
  
      Layouts myLayout = new Layouts();
  
      rows = myLayout[numSquares].r; //this is where it fails
      columns = myLayout[numSquares].c;
  }
  
  class RowCol&lt;R, C&gt; {
  
      /* Class Variables */
      public final R r;
      public final C c;
  
      public RowCol(R r, C c) {
          this.r = r;
          this.c = c;
      }
  
      public R getRow() {return r;}
      public C getCol() {return c;}
  }
  
  class Layouts {
  
      RowCol[] myLayouts;
  
      public Layouts() {
  
          /* Set the numbers of Rows and Columns for each possible
           * number of squares requested.
           */
              myLayouts[20] = new RowCol(5, 4);   // 20 Problems
              myLayouts[21] = new RowCol(7, 3);   // 21 Problems
              myLayouts[22] = new RowCol(5, 4);   // 22 Problems
              myLayouts[23] = new RowCol(5, 4);   // 23 Problems
              myLayouts[24] = new RowCol(6, 4);   // 24 Problems
              myLayouts[25] = new RowCol(5, 5);   // 25 Problems
              myLayouts[26] = new RowCol(6, 4);   // 26 Problems
              myLayouts[27] = new RowCol(6, 4);   // 27 Problems
              myLayouts[28] = new RowCol(7, 4);   // 28 Problems
              //etc...
  </code></pre>
  
  <p>Edit: Applying the responses below, I needed to intantiate an object in the Layouts class, which I did. Then, I modified the getLayout class to isolate the returned RowCol value. Here is that class updated. My issue at this point is that I can't convert the row and column into integers so that I can use them as such.</p>
  
  <pre><code>public static void getLayout(int numSquares) {
  
      Layouts myLayout = new Layouts();
      RowCol myRC = myLayout.getLayout(numProbs);
      int rows = Integer.parseInt(myRC.getRow());
      int cols = Integer.parseInt(myRC.getCol());
  }
  </code></pre>
  
  <p>The error is:</p>
  
  <blockquote>
    <p>no suitable method found for parseInt(Object)
        method Integer.parseInt(String) is not applicable
          (actual argument Object cannot be converted to String by method invocation conversion)
        method Integer.parseInt(String,int) is not applicable
          (actual and formal argument lists differ in length)</p>
  </blockquote>
  
  <p>EDIT: Solved. Thanks everybody!</p>