Advertisement
Guest User

Untitled

a guest
Feb 24th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. package com.mail.lenka949;
  2.  
  3. import java.io.IOException;
  4. import java.nio.file.Files;
  5. import java.nio.file.Paths;
  6.  
  7. public class Main {
  8.  
  9. public static void main(String[] args) {
  10. // TODO Auto-generated method stub
  11.  
  12. int k;
  13. try {
  14. k = Files.lines(Paths.get("nums.txt"))
  15. .filter(n -> n != null)
  16. .mapToInt(n -> (int) Integer.parseInt(n))
  17. .reduce(0, (a, b) -> Integer.max(a, b));
  18. } catch (IOException e) {
  19. e.printStackTrace();
  20. k = -1;
  21. }
  22. System.out.println(k);
  23.  
  24. }
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement