title: Print all possible combinations for a given array of elements
body: <pre><code>public class TestPossibleNumbers {
  public static void main(String[] args) {
      int input[] = { 1, 2, 3 };
      // int input[] = {10,11,12,13};
      possibleNumbers(input, 0);
  }
  
  public static void possibleNumbers(int[] x, int index) {
      if (index == x.length) {
          for (int i = 0; i &lt; x.length; i++) {
              System.out.print(x[i] + " ");
          }
          System.out.println();
      }
      for (int i = index; i &lt; x.length; i++) {
          int temp = x[index];
          x[index] = x[i];
          x[i] = temp;
          possibleNumbers(x, index + 1);
  
          temp = x[index];
          x[index] = x[i];
          x[i] = temp;
      }
  }}
  </code></pre>
  
  <p>Can anyone help me to understand the code inside for loop?
  This program run perfectly. But, I am unable to figure out how it is working</p>