当给出Double Integer并且该整数的数字被推入数组时。如何在数组中混淆这些数字?
答案 0 :(得分:1)
当给出双重整数时
这句话是错误的,正如@Mike Kobit所提到的,double与整数不同,但对于整数数组
Integer i[]=new Integer[]{1,2,3,4,5};
List<Integer> list=Arrays.asList(i);
System.out.println(list); ------> Before Shuffling
Collections.shuffle(list);
System.out.println(list); -------> After shuffling
list.toArray(i); -----> Convert list back to array
输出
[1, 2, 3, 4, 5] -->Before Shuffling
[1, 3, 4, 2, 5] --> After Shuffling