title: Can't find right position on array
body: <p>I have a table in my database and it has some columns like <code>time</code> and <code>text</code>... I want to have all entries existing in any columns in separate string arrays...</p>
  
  <p>I'm sure that two string array correctly collect entries (using toast for test!) ...my first array is <code>texts</code> and second is <code>times</code>... I want to find <strong>two last inserted text</strong> according to inserting <code>time</code>... if I find two maximum <code>time</code>s in <code>times</code> array, using their position, I can find related text from <code>texts</code> array... here is my code:</p>
  
  <pre><code>        double maxtime = 0;
          double second_maxtime = 0;
  
          for (int counter = 0; counter &lt; i; counter++) {
  
                  if (Double.parseDouble(times[counter]) &gt; maxtime) {
                      second_maxtime = maxtime;
                      maxtime = Double.parseDouble(times[counter]);
                  } else if (Double.parseDouble(times[counter]) &gt; second_maxtime &amp;&amp;           Double.parseDouble(times[counter]) != maxtime) {
  
                      second_maxtime = Double.parseDouble(times[counter]);
                  }
           }
  
          long scndmxt= Math.round(second_maxtime);
          String scndmaxt = String.valueOf(scndmxt);
          int pos = Arrays.asList(times).indexOf(scndmaxt);
  
          long mxt = Math.round(maxtime);
          String maxt = String.valueOf(mxt);
          int pos1 = Arrays.asList(times).indexOf(maxt);
  
            String  last_text  = texts[pos];
            String  second_last_text = texts[pos1];
  </code></pre>
  
  <p>but when i try with toast to test it works correctly or not, it can find two last time correctly(<code>mxt</code> and <code>scndmxt</code>) ... but their position are not right... sometimes are <code>-1</code> and <code>0</code>.. and sometimes are <code>0</code> ad <code>1</code>...</p>
  
  <p>i tried <code>int pos = Arrays.asList(otherArray).indexOf(...);</code> for other array and it works correctly...but here, I should convert strings to double for comparing ...  any help?!! thanks...</p>