You may receive a WARNING like this:
Float(double) in java.lang.Float has been deprecated and marked for removal
and more:
The constructor Boolean(boolean) is deprecated
The constructor Byte(byte) is deprecated
The constructor Short(short) is deprecated
The constructor Character(char) is deprecated
The constructor Long(long) is deprecated
The constructor Float(float) is deprecated
The constructor Double(double) is deprecated
Because public constructor of such wrapper classes will be removed in the future.
Official Javadoc
You can use .valueOf()
or parseFloat()
(transform from a String) instead.
If you want to do type casting, just use (float) doubleValue;