getting all possible ordering of vector

hello

I need to find all possible order of a set of vector I mean if I have the following:

0

1

2

all posssible would be:

0 1 2, 1 0 2, 2 1 0, 1 2 0, 2 0 1, 0 2 1

I have tried to use the swap but I didn't get all possible set

I have used the following code:

Code:

`for( int x=0;x<vector.size();x++) { `

for ( int w=0;w< vector.size();w++){

Collections.swap(vector, x, w);}}

as I said before the swap method didn't provide me the result I want

can somebody tell me how to do it please urgent