You can use Java’s Float class like below:
float f = Float.parseFloat("25");
String s = Float.toString(25.0f);
The better way is to convert the string to float and compare as two floats. Because a float can have multiple string representations, which turns out to be different if you compare it as strings(e.g. "25" != "25.0" != "25.00" etc.)
Interested in Java? Check out this Java tutorial by Intellipaat.