Advertisement
Guest User

Untitled

a guest
Mar 24th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. package practice;
  2.  
  3. import java.io.FileInputStream;
  4. import java.io.FileNotFoundException;
  5. import java.util.ArrayList;
  6. import java.util.List;
  7. import java.util.Scanner;
  8.  
  9. public class FileInput{
  10.  
  11. public int[] inputMethod() {
  12.  
  13. try {
  14. Scanner inFile = new Scanner(new FileInputStream("input1.txt"));
  15. String n = inFile.nextLine();
  16. List<Integer> list = new ArrayList<Integer>();
  17.  
  18. while (inFile.hasNextInt())
  19. if(inFile.nextInt < n)
  20. { list.add(inFile.nextInt());
  21. list.stream().mapToInt(i -> i).toArray();
  22. }
  23.  
  24. }
  25.  
  26. inFile.close();
  27.  
  28. } catch (FileNotFoundException fnfe) {
  29. System.out.println("File not found!!");
  30. }
  31.  
  32.  
  33.  
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement