java.lang.Math

四舍五人

System.out.println(Math.round(1.8f));//输出位2

 static(静态)方法random() 

//: object/Shifting.java

package object;
import static net.util.Print.*;


public class Shifting
{
public static void main(String[] args)
{
double n = Math.random();
System.out.println(n);//产生0-1之间的double数,包括0,不包括1
}
}


原文地址:https://www.cnblogs.com/jiangfeilong/p/9971893.html