title: Filtering a two-dimensional array and creating new arrays with its data
body: <p>Tell me please, how is it possible to implement the following task?
  I need to filter the array by the last value of the string, put it in a new array.
  Those. In this example, 1 row should be in 1 array, and in the second, 2 others.
  I checked the array for the presence of a specific value like I did</p>
  
  <pre><code>boolean x  = Arrays.asList(matrixA).contains("a");
  </code></pre>
  
  <p>But I can not figure out how to proceed further and write the whole line into a new array?</p>
  
  <pre><code>public class arr {
      public static void main(String[] args) throws IOException {
          String[][] matrixA = {
                  {"1", "1", "a"},
                  {"2", "2", "c"},
                  {"3", "3", "c"}};
  
          for (int i = 0; i &lt; 3; i++) {
              for (int j = 0; j &lt; 3; j++) {
  
  
                  boolean x  = Arrays.asList(matrixA).contains("a");
                  if (x==true)
                  {
  
                  }
  
  
                  boolean c  = Arrays.asList(matrixA).contains("c");
                  if (c==true)
                  {
  
                  }
  
                  System.out.print(matrixA[i][j] + " ");
              }
              System.out.println();
          }
      }
  }
  </code></pre>
  
  <p>At the end there must be 2 arrays</p>
  
  <pre><code>    Arr1{
       {"1", "1", "a"}};
      Arr2{
       {"2", "2", "c"},
       {"3", "3", "c"}};
  </code></pre>