int[]转为流进行排序

nums = IntStream.of(nums)
                .boxed()
                .sorted((o1, o2) -> (Math.abs(o2) - Math.abs(o1)))
                .mapToInt(Integer::intValue).toArray();

 

posted @ 2021-12-03 13:34  Peterxiazhen  阅读(218)  评论(0编辑  收藏  举报