title: Alphabetizing a 2d array in java
body: <p>I have a 2d array containing first name, last name, and a third irrelevant piece of data on each row. I need to alphabetize each row based on last name. How can I accomplish this?</p>
  
  <p>I've tried using java.util.Arrays.sort(array[0]); but I can only get it to sort one row or one column. I need to keep the first name and last name together and sort by last name.</p>
  
  <p>so say i have this array</p>
  
  <pre><code>String array [][]=new String[3][2];
         array[0][0]="Kyle";
         array[0][1]="Johnson";
         array[1][0]="Drew";
         array[1][1]="Anderson";
         array[2][0]="Jacob";
         array[2][1]="Peterson";
  </code></pre>
  
  <p>which is build like this</p>
  
  <p>Kyle | Johnson</p>
  
  <p>Drew | Anderson</p>
  
  <p>Jacob| Peterson</p>
  
  <p>and i need it to end up like this</p>
  
  <p>Drew | Anderson</p>
  
  <p>Kyle | Johnson</p>
  
  <p>Jacob| Peterson</p>