AndreiS

Untitled

Apr 5th, 2015
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. private void readData(String filename) {
  2. Scanner scanner = null;
  3.  
  4. try {
  5.  
  6. scanner = new Scanner(new File(filename));
  7.  
  8. this.N = scanner.nextInt();
  9. this.K = scanner.nextLong();
  10. this.vector = new long[N];
  11.  
  12. for(int i = 0; i < N; i++)
  13. this.vector[i] = scanner.nextInt();
  14.  
  15. } catch (Exception e) {
  16. e.printStackTrace();
  17. } finally {
  18. try {
  19. if (scanner != null)
  20. scanner.close();
  21. } catch (Exception ex) {
  22. ex.printStackTrace();
  23. }
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment