-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPermutations.java
More file actions
32 lines (28 loc) · 925 Bytes
/
Permutations.java
File metadata and controls
32 lines (28 loc) · 925 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import java.util.ArrayList;
import java.util.*;
public class Permutations
{
public Permutations(){
}
public static void main (String[] args){
ArrayList<Integer> numbers = new ArrayList<Integer>();
ArrayList<Integer> printNum = new ArrayList<Integer>();
for(int a = 0; a <= 10; a++){
for(int i = 1; i <= 10; i++){
numbers.add(i);
}
System.out.print("List " + a + " : ");
for(int i = 10; i >= 1; i--){
Random random = new Random();
int c = random.nextInt(i);
printNum.add(numbers.get(c));
numbers.remove(c);
}
for(int i = 10; i >= 1; i--){
System.out.print(printNum.get(i-1) + " ");
printNum.remove(i-1);
}
System.out.println();
}
}
}