I try to read the numbers from the file with scanner. But I can't read one by one. How can i do that?
This is my txt
000000000000000000000000000000000000000
and this is my code
ArrayList<Integer>x = new ArrayList<>();
Scanner scan;
try {
scan = new Scanner(new FileInputStream(new File("d:/deneme.txt")));
while(scan.hasNext()){
int y = scan.nextInt();
System.out.println(y);
x.add(y);
}
scan.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}