A simple text scanner which can parse primitive types and strings using regular expressions.
A Scanner breaks its input into tokens using a delimiter pattern, which by default matches whitespace. The resulting tokens may then be converted into values of different types using the various next methods.
http://docs.oracle.com/javase/1.5.0/docs/api/java/util/Scanner.html
here is answer: Faster way to read file