未找到 FloatMath.sqrt()方法

我正在使用新的 Android M SDK,但是方法 FloatMath.sqrt()已经不存在了,现在我应该使用什么呢?

47804 次浏览

The documentations say this:

Historically these methods were faster than the equivalent double-based java.lang.Math methods. On versions of Android with a JIT they became slower and have since been re-implemented to wrap calls to java.lang.Math. java.lang.Math should be used in preference.

All methods were removed from the public API in version 23.

@deprecated Use java.lang.Math instead.

This means the solution is to use the Math class:

(float)Math.sqrt(...)