You can parse through each line by using a StringTokenizer (Java Platform SE 6) From there you can parse a String representation of an integer to an int using Integer.parseInt().