title: Finding the Nth Smallest number, How to fix my method "int minNumber(int[] numbers, int selected)"?
body: <p>I just want to code a method to find Nth smallest number, there are many ways to do it but I want to write it in a different way.
  When I call my method like this, it shows me not correct result</p>
  
  <pre><code>int[] numbers = {200, 700, 11, 4, 10, 6, 19, 40};
  System.out.println(minNumber(numbers, 7));
  </code></pre>
  
  <p>when I try to reach 7th and 8th smallest number it is not gonna work! :(<br>
  I do not know how to fix the main problem I mean if I change my array to another array with different range.<br>
  <strong>Note</strong>: It has to work with every possible integer array.</p>
  
  <pre class="lang-java prettyprint-override"><code>static int minNumber(int[] numbers, int selected) {
    if(numbers == null || numbers.length &lt;= 0) return -1;
    int intReturn = 0;
    int[] intMinNumbers = new int[numbers.length];
    int intFound = 0;
    for(int s=0; s&lt;=selected; s++) {
      intReturn = numbers[0];
      System.out.println("-loop: "+s);
      for(int i=0; i&lt;numbers.length; i++) {
        boolean scape = false; //I think my problem is inside this loop below. from here
        for(int min=0; min&lt;=intFound; min++) {
          if(intMinNumbers[min] != 0 &amp;&amp; numbers[i] == intMinNumbers[min]) {
            scape = true;
            break;
          }
        }
        if(scape) continue; // to here
        if(numbers[i] &lt; intReturn) {
          intReturn = numbers[i];
          System.out.println("--"+intReturn);
        }
      }
      intMinNumbers[s] = intReturn;
      intFound++;
    }
    return intReturn;
  }
  </code></pre>
  
  <p>This is the output when I run my code :_</p>
  
  <pre><code>-loop: 0
  --11
  --4
  -loop: 1
  --11
  --10
  --6
  -loop: 2
  --11
  --10
  -loop: 3
  --11
  -loop: 4
  --19
  -loop: 5
  --40
  -loop: 6 // &lt;--this part is wrong
  -loop: 7 // &lt;--this part is wrong
  200      // &lt;--this part is wrong
  but I expect this, to show it to me
  -loop: 0
  --11
  --4
  -loop: 1
  --11
  --10
  --6
  -loop: 2
  --11
  --10
  -loop: 3
  --11
  -loop: 4
  --19
  -loop: 5
  --40
  -loop: 6
  --200
  -loop: 7
  700
  </code></pre>