Advertisement
Guest User

Untitled

a guest
Feb 24th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. package com.mail.lenka949;
  2.  
  3. import java.util.Arrays;
  4.  
  5. public class Main {
  6.  
  7. public static void main(String[] args) {
  8. // TODO Auto-generated method stub
  9.  
  10. int[] array = { 2, 6, 3, 8, 1, 2, 3, 4, 5, -1, -2, 4 };
  11. int k = Arrays.stream(array).mapToObj(n -> n).sorted((nOne, nTwo) -> Math.abs(nOne) - Math.abs(nTwo))
  12. .findFirst().orElse(null);
  13. System.out.println(k);
  14. }
  15.  
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement