OH3 - The constructor Float(String) is deprecated

I have been spending a little over two weeks modifying OH 2.x code to OH 3.x code and I’m stuck with fixing these.

Got 3 of these warnings for the rules below - The constructor Float(String) is deprecated

var String results = executeCommandLine(Duration.ofSeconds(60), "/bin/bash", "/etc/openhab/scripts/ThreadCount.sh")	
KarafThreadsResult.postUpdate(results) 
var Number Numberresults = (Float::parseFloat(String::format("%s",results).replace(',','.')))


truncatedString = String::format("%.2f", Float.parseFloat(truncatedString))
OWMCurrentPressure_Rounded.postUpdate(Float::parseFloat(String::format("%s",truncatedString)))


var String Temp    = transform("JSONPATH", "$.['Realtime Currency Exchange Rate']['5. Exchange Rate']", results.toString())
Temp = String::format("%.2f", Float.parseFloat(Temp))
BTC_USD_JSON.postUpdate(Float::parseFloat(String::format("%s",BTCvalue))) 

Any help would be appreciated.

Best, Jay

It’s a Java message, deprecated since Java 9
https://docs.oracle.com/javase/9/docs/api/java/lang/Float.html
example usage of valueOf()

Found out that these where all correct statements NOT causing the deprecated warnings. These statements below are the culprit with the fixes in them.

                    var String[] results = speedtestCliOutput.split("\\r?\\n")
			        // var float ping = new java.lang.Float(results.get(0).split(" ").get(1))
			        // var float down = new java.lang.Float(results.get(1).split(" ").get(1))
			        // var float up   = new java.lang.Float(results.get(2).split(" ").get(1))
					
			        var float ping = Float.valueOf(results.get(0).split(" ").get(1))
			        var float down = Float.valueOf(results.get(1).split(" ").get(1))
			        var float up   = Float.valueOf(results.get(2).split(" ").get(1))

Best, Jay