def numbers = $objectWrappers.wrap($arrays.arrayOf($plugins.loadClass("java.lang.Integer"), 10, 20, 30, 20, 40)) // 查找元素 20 的第一个索引 def indexOf20 = numbers.indexOf(20) // 输出:元素 20 的第一个索引: 1 $console.log("元素 20 的第一个索引: ", indexOf20) // 查找元素 50 的索引(如果不存在,则返回 -1) def indexOf50 = numbers.indexOf(50) // 输出:元素 50 的索引: -1 $console.log("元素 50 的索引: ", indexOf50)