private void swap(int a[], int x, int y)
    {
        if(x < 0 || y < 0 || x >= a.length || y >= a.length || x == y)
        {
            return;
        }

        int temp = a[x];
        a[x] = a[y];
        a[y] = temp;
    }