void readMyFile() { DataInputStream dis = null; String record = null; int index = 0; try { File f = new File("dictionary.txt"); FileInputStream fis = new FileInputStream(f); BufferedInputStream bis = new BufferedInputStream(fis); dis = new DataInputStream(bis); while( (record = dis.readLine()) != null ) { words.add(index); index++; System.out.println(index + ": " + record); } }