Java中绝对值函数使用说明
互联网品牌圈关注到Java中绝对值函数使用说明
绝对值函数使用说明
绝对值函数是JDK中Math.java中的实现方法,其用来得到表达式的绝对值。
其实现非常简单,源码如下:
/*** Returns the absolute value of an {@code int} value.* If the argument is not negative, the argument is returned.* If the argument is negative, the negation of the argument is returned.** <p>Note that if the argument is equal to the value of* {@link Integer#MIN_VALUE}, the most negative representable* {@code int} value, the result is that same value, which is* negative.** @param a the argument whose absolute value is to be determined* @return the absolute value of the argument.*/public static int abs(int a) {return (a < 0) ? -a : a;}
尊敬的看官您对Java中绝对值函数使用说明有什么看法呢?互联网品牌制作专家愿与您共同探讨!版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请加微信号oem365 举报,一经查实,本站将立刻删除。上一篇: java绝对值函数特性和运用 返 回 下一篇:C\C++中绝对值函数如何表达