title: How to sort multiple arrays in java
body: <p>I'm trying to sort three arrays by lexicographical order. The arrays are related to each other by a common array.  It's easier to explain if I demonstrate:</p>
  
  <pre><code>int[] record = new int[4];
  String [] colors = {"blue", "yellow", "red", "black"};
  String [] clothes = {"shoes", "pants", "boots", "coat"};
  </code></pre>
  
  <p>When printed on the console, I would like them to be put in three columns similar to below:</p>
  
  <h2>Unsorted:</h2>
  
  <pre><code>Record  Color   Clothes
  0       blue    shoes
  1       yellow  pants
  2       red     boots
  3       black   coat
  </code></pre>
  
  <h2>Sorted by Color:</h2>
  
  <pre><code>Record  Color   Clothes
  3       black   coat
  0       blue    shoes
  2       red     boots
  1       yellow  pants
  </code></pre>
  
  <h2>Sorted by Clothes:</h2>
  
  <pre><code>Record  Color   Clothes
  2       red     boots
  3       black   coat
  1       yellow  pants
  0       blue    shoes
  </code></pre>
  
  <p>I found a previous answer similar to my scenario, but it compared integers instead of strings, and I'm having trouble using the <code>compareTo()</code> method and <code>Arrays.sort()</code> to arrive at my desired output.</p>
  
  <p>Any help would be appreciated!</p>