. , .
Collections.shuffle
:
// you can replace this with however you want to populate your array.
// You can do a for loop that loops from 1 to 9 and add each number.
ArrayList<Integer> list = new ArrayList<>(Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9));
Collections.shuffle(list);
// now "list" is in a random order
EDIT:
, , , . , ArrayList
. ArrayList
, .
, Stream
, , , .
10 :
IntStream.range(1, 10).parallel().forEach(System.out::print);
:
347195628
342179856
832497165
328194657
326479581
341287956
873629145
837429156
652378914
632814579