Problems reading long types from a text file using the Java scanner


I'm trying to read a long type from a text file using Scanner in Java. I get the following error:

Exception in thread "main" java.util.InputMismatchException
at java.util.Scanner.throwFor(
at java.util.Scanner.nextLong(
at java.util.Scanner.nextLong(
at Project.main(

Which correlates to this line:

strLine = (long) in.nextLong();

If I do it will work, but I need to store the info as a long, not as a String. The exact number it's getting mad at reading is: 3.20e11

Anyone know how to fix this? Thanks in advance!

3.20e11's double.

You should do:

strLine = (long) in.nextDouble();