System.out.println("----------------Math方法--------------");
System.out.println("返回參數(shù)的絕對(duì)值:"+ Math.abs(-1));
System.out.println("返回一個(gè)隨機(jī)值(取得一個(gè)大于或者等于0.0小于不等于1.0的隨機(jī)數(shù) ):"+ Math.random());
System.out.println("返回第一個(gè)參數(shù)的第二的參數(shù)的方"+ Math.pow(2,5));
System.out.println("返回最大值"+ Math.max(2,5));
System.out.println("返回最小值"+ Math.min(2,5));
System.out.println("四舍五入,返回double類型:"+ Math.rint(10.1));
System.out.println("四舍五入,返回double類型:"+ Math.rint(10.5));
System.out.println("四舍五入,返回double類型:"+ Math.rint(10.7));
System.out.println("round四舍五入秕衙,float時(shí)返回int值,double時(shí)返回long值"+ Math.round(10.42));
System.out.println("round四舍五入,float時(shí)返回int值店茶,double時(shí)返回long值"+ Math.round(10.511));
System.out.println("ceil天花板的意思可训,就是返回大的值定踱,注意一些特殊值"+ Math.ceil(-0.7));
System.out.println("floor地板的意思,就是返回小的值"+ Math.floor(-0.7));
//常用值與函數(shù):
//? ? ? ? Math.PI記錄的圓周率
//? ? ? ? Math.E記錄e的常量
//? ? ? ? Math中還有一些類似的常量迫筑,都是一些工程數(shù)學(xué)常用量引润。
//? ? ? ? Math.abs求絕對(duì)值
//? ? ? ? Math.sin正弦函數(shù)Math.asin反正弦函數(shù)
//? ? ? ? Math.cos余弦函數(shù)Math.acos反余弦函數(shù)
//? ? ? ? Math.tan正切函數(shù)Math.atan反正切函數(shù)Math.atan2商的反正切函數(shù)
//? ? ? ? Math.toDegrees弧度轉(zhuǎn)化為角度Math.toRadians角度轉(zhuǎn)化為弧度
//? ? ? ? Math.ceil得到不小于某數(shù)的最大整數(shù)
//? ? ? ? Math.floor得到不大于某數(shù)的最大整數(shù)
//? ? ? ? Math.IEEEremainder求余
//? ? ? ? Math.max求兩數(shù)中最大
//? ? ? ? Math.min求兩數(shù)中最小
//? ? ? ? Math.sqrt求開方
//? ? ? ? Math.pow求某數(shù)的任意次方,拋出ArithmeticException處理溢出異常
//? ? ? ? Math.exp求e的任意次方
//? ? ? ? Math.log10以10為底的對(duì)數(shù)
//? ? ? ? Math.log自然對(duì)數(shù)
//? ? ? ? Math.rint求距離某數(shù)最近的整數(shù)(可能比某數(shù)大巩趁,也可能比它小)
//? ? ? ? Math.round同上淳附,返回int型或者long型(上一個(gè)函數(shù)返回double型)
//? ? ? ? Math.random返回0晶渠,1之間的一個(gè)隨機(jī)數(shù)
System.out.println("----------------Math方法--------------")凰荚;
摘錄: https://www.cnblogs.com/androidaihaozhe/p/4466466.html
http://blog.csdn.net/huxu981598436/article/details/16359807