Integer [] items = new Integer[]{-2,-3,-4,-5,-1,1,2,3,4,5}; int a= (int) Math.floor(Math.random()*items.length); Integer i = items[a]; System.out.println("kdjkjdjkj"+i);
JAVA数组任意取值,任意取一个值,随机取值
最新推荐文章于 2024-09-18 23:47:25 发布
Integer [] items = new Integer[]{-2,-3,-4,-5,-1,1,2,3,4,5}; int a= (int) Math.floor(Math.random()*items.length); Integer i = items[a]; System.out.println("kdjkjdjkj"+i);