集册 Java实例教程 使用Math.floor查找数字的底值

使用Math.floor查找数字的底值

欢马劈雪     最近更新时间:2020-01-02 10:19:05

506
提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
要查找底值,请使用Math类的静态double floor(double d)方法。


public class Main {

 

  public static void main(String[] args) {//from n  o  w  j  a  v  a . c o m

    System.out.println(Math.floor(110));

   

    System.out.println(Math.floor(310.1));

   

    System.out.println(Math.floor(115.5));

   

    System.out.println(Math.floor(-41));

   

    System.out.println(Math.floor(-421.4));

   

    System.out.println(Math.floor(0));

   /**来自 N o w J a v a . c o m**/

  }

}