Hi, I want to know to rows and columns of numbers from a text file.
I do not want to read it as a string, but one number (including numbers with decimal) by itself. I tried using FileInputStream and DataInputStream, but I'm not really good at it. I don't know how to not read it as a double, and not a string.

Re: How to read numbers from text file 80 80

What might also work then in that case, is maybe just converting the string that you're getting to an int or what ever you want? As in:

myInt = Integer.parseInt(theStringThatYoureGetting);
Re: How to read numbers from text file 80 80

Following Dean_Grobler's suggestion you may read each number as a string s, and then convert s into a decimal number in the type of double by the following line of code:

double d = Double.parseDouble(s);

or convert s into a decimal number in the type of float:

float f = Float.parseFloat(s);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.