title: How can i order products array by id
body: <p>i hope you can help me i am trying to order these arrays </p>
  
  <pre><code>int pumpno[] = new int[] { 3, 4, 5, 3, 4, 6};
  String desc[] = new String[] {"jam", "chesse", "milk", "water",   "soup","bread"};
  int cost[] = new int[] {10, 15, 23, 43, 12, 67};
  </code></pre>
  
  <p>I want to print in these order:</p>
  
  <pre><code>id   3 
  ----------
  desc jam
  
  cost 10
  
  desc water
  
  cost 43
  
  id   4
  ----------
  desc chesse
  
  cost 15
  
  desc soup
  
  cost 12
  
  
  id   5 
  ----------
  desc milk
  
  cost 23
  
  id   6
  ----------
  desc bread
  
  cost 63
  </code></pre>
  
  <p>For example each array has the same lenght in this case is 9, in the firts array theare numbers with the same value for the id so, i just want to print once time the value for id and print all de values below with the same id </p>
  
  <p>i just have make how to know if is equal id  i make it with these </p>
  
  <pre><code>Set&lt;String&gt; set = new HashSet&lt;String&gt;();
  for (int i = 0; i &lt; pumpno.length; i++) {
  if (set.contains(pumpno[i])) {
      Log.d("Duplicate ", pumpno[i]);
  } else {
      set.add(pumpno[i]);
  }
  </code></pre>
  
  <p>But i have no idea how to print like the example above. if you can help me thanks a lot</p>