The float value at that high value has a precision of only 0.5, so Java parsed it to the closest float value it could = 5555998.5, and that's what was printed.
To see the difference between the 2 closest values at that magnitude, use Math.ulp (unit in the last place):
String s = "5555998.558f";
float value = Float.parseFloat(s);
System.out.println(value);
System.out.println(Math.ulp(value));
This prints
5555998.5
0.5
You can use a double which has much better precision:
double d = Double.parseDouble(s);
System.out.println(d);
System.out.println(Math.ulp(d));
This prints
5555998.558
9.313225746154785E-10
Interestingly, Double.parseDouble doesn't seem to mind the f on the end. Double.parseDouble converts the String into a double "as performed by the valueOf method of class Double". And Double.valueOf states:
FloatValue:
This method will take a String as if it were a Java numeric literal, which Java supports with a f on the end to indicate a floating-point literal.
BigDecimal?floatinstead of eitherdoubleorBigDecimal.