Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package practice;
- import java.io.FileInputStream;
- import java.io.FileNotFoundException;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.Scanner;
- public class FileInput{
- public int[] inputMethod() {
- try {
- Scanner inFile = new Scanner(new FileInputStream("input1.txt"));
- String n = inFile.nextLine();
- List<Integer> list = new ArrayList<Integer>();
- while (inFile.hasNextInt())
- if(inFile.nextInt < n)
- { list.add(inFile.nextInt());
- list.stream().mapToInt(i -> i).toArray();
- }
- }
- inFile.close();
- } catch (FileNotFoundException fnfe) {
- System.out.println("File not found!!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement