Why does parsing a float into array cause precision loss error. I am trying to sort data from a text file that contains text, integers and float numbers. Using the for statement causes loss of precision errors. How do I correct this please.

float y;
for (float k = 0; k < array.length; k++);
float y = Float.parseFloat( array[k] );

Why would you declare "k" as type float? It should be declared as an int. Also, the ";" at the end of the for loop ends the loop. In other words, the for loop does not apply to the line directly after it since the ";" is there. Repost the code and tell us what errors (if any) you get.

Be a part of the DaniWeb community

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