Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.mail.lenka949;
- import java.io.IOException;
- import java.nio.file.Files;
- import java.nio.file.Paths;
- public class Main {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- int k;
- try {
- k = Files.lines(Paths.get("nums.txt"))
- .filter(n -> n != null)
- .mapToInt(n -> (int) Integer.parseInt(n))
- .reduce(0, (a, b) -> Integer.max(a, b));
- } catch (IOException e) {
- e.printStackTrace();
- k = -1;
- }
- System.out.println(k);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement