title: How to convert String to int and compare it by using Comparator
body: <p>This is how i am comparing 2 Strings value, the values are in number, It works perfectly fine until it receive a value equal or greater than 10.</p>
  
  <p>So i need to convert these values to integer.</p>
  
  <p><code>TXCartData</code> class has <code>String rowID</code></p>
  
  <p>This is what i was doing. </p>
  
  <pre><code>Collections.sort(data, new Comparator&lt;TXCartData&gt;() {
      @Override
      public int compare(TXCartData lhs, TXCartData rhs) {
          return lhs.rowId.compareToIgnoreCase(rhs.rowId);
      }
  });
  </code></pre>
  
  <p>I have tried to change <code>rowID</code> to integer, but its giving me an error message, as its expecting 0 or 1 in output, and <code>1==1</code> returns <code>true</code> of <code>false</code>.</p>
  
  <p>This is what i tried.</p>
  
  <pre><code>Collections.sort(data, new Comparator&lt;TXCartData&gt;() {
      @Override
      public int compare(TXCartData lhs, TXCartData rhs) {
          return Integer.parseInt(lhs.rowId)== Integer.parseInt(rhs.rowId);
      }
  });
  </code></pre>
  
  <p>The data list is very large, I sort it three times by using <code>Comparator</code>and get accurate result, The first 2 are strings and it sorted them accurately, but on the last one it fails.</p>