常用API

Math

Java中Math类的常用方法有:

  1. abs(x):返回x的绝对值。
  2. ceil(x):返回大于等于x的最小整数。
  3. floor(x):返回小于等于x的最大整数。
  4. round(x):返回最接近x的整数,四舍五入。
  5. max(x, y):返回x和y中的最大值。
  6. min(x, y):返回x和y中的最小值。
  7. pow(x, y):返回x的y次幂。
  8. sqrt(x):返回x的平方根。
  9. random():返回一个0.0到1.0之间的随机数。
  10. sin(x)、cos(x)、tan(x):返回x的正弦、余弦、正切值。
  11. log(x)、log10(x):返回x的自然对数和以10为底的对数。
  12. exp(x):返回e的x次幂。
Donate
  • Copyright: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.

扫一扫,分享到微信

微信分享二维码
  • Copyrights © 2023-2025 Annie
  • Visitors: | Views:

嘿嘿 请我吃小蛋糕吧~

支付宝
微信