title: HackerRank closest number
body: <p>Given a list of unsorted integers, find the pair of elements that have the smallest absolute difference between them. If there are multiple pairs, find them all.</p>
  
  <p>My reasoning was to compare each: <code>arr[j] - arr[i]</code> with <code>lowest</code> and if it is smaller or equal to that, add that value to the array lowest, but it's not working. </p>
  
  <p>Code:</p>
  
  <pre class="lang-java prettyprint-override"><code>static int[] closestNumbers(int[] arr) {
      int lowest = arr[1] - arr[0];
      int lowestArray[] = new int[arr.length];
      for (int i = 0; i &lt; arr.length; i++) {
          for (int j = i + 1; j &lt; arr.length; j++) {
              if (Math.abs(arr[j] - arr[i]) &lt; lowest) {
                  lowest = Math.abs(arr[j] - arr[i]);
              }
          }
      }
  
      for (int i = 0; i &lt; arr.length; i++) {
          if (arr[i] == lowest) {
              lowestArray[i] = arr[i];
          }
      }
      return lowestArray;
  }
  </code></pre>