Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.mail.lenka949;
- import java.util.Arrays;
- public class Main {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- int[] array = { 2, 6, 3, 8, 1, 2, 3, 4, 5, -1, -2, 4 };
- int k = Arrays.stream(array).mapToObj(n -> n).sorted((nOne, nTwo) -> Math.abs(nOne) - Math.abs(nTwo))
- .findFirst().orElse(null);
- System.out.println(k);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement