title: sort only the positive value and remain the negative value with it's index as it is of an array
body: <p>I need to sort the array in ascending order only for the positive value. 
  For the negative value the index position will remain the same as it is. </p>
  
  <p>If the array is : <code>int[] inputArray = {-1, 150, 190, 170, -1, -1, 160, 180}</code>. </p>
  
  <p>The output should be like this - <code>int[] outputArray = {-1, 150, 160, 170, -1, -1, 180, 190}</code>. </p>
  
  <p>But in my case the output 
  is this - <code>int[] outputArray = {-1, 150, 170, 190, -1, -1, 160, 180}</code>. </p>
  
  <p>Here is my code below :</p>
  
  <pre><code>public static void main(String[] args) {
      int[] inputArray = {-1, 150, 190, 170, -1, -1, 160, 180};
      int[] outputArray = sortByHeight(inputArray);
  
      for (int item : outputArray) {
          System.out.print(item + ", ");
      }
  }
  
  public static int[] sortByHeight(int[] inputArray) {
      for (int i=0; i&lt;inputArray.length; i++) {
          for (int j = 0; j&lt;inputArray.length - 1; j++) {
              int temp = inputArray[j];
              if (temp &gt;= 0) {
                  if (inputArray[j] &gt; inputArray[j+1] &amp;&amp; inputArray[j+1] &gt;= 0) {
                      inputArray[j] = inputArray[j+1];
                      inputArray[j+1] = temp;
                  }
              }
          }
      }
      return inputArray;
  }
  </code></pre>