package com.swift;

public class MathDemo {

    public static void main(String[] args) {
// TODO Auto-generated method stub
//数学类的小总结 Math
System.out.println(Math.pow(4, 3));//幂运算 64
System.out.println(Math.pow(4, 0.5));//4的开方
System.out.println(Math.pow(2, -2));//0.25 2的2次幂分之1
System.out.println(Math.sqrt(16));//0.25 2的2次幂分之1 square root sqrt
System.out.println(Math.sqrt(25));//0.25 2的2次幂分之1
System.out.println(Math.abs(-3));//0.25 2的2次幂分之1 absolute
System.out.println(Math.ceil(2.6));//0.25 2的2次幂分之1 absolute
System.out.println(Math.ceil(2.1));//0.25 2的2次幂分之1 absolute
System.out.println(Math.floor(2.1));//0.25 2的2次幂分之1 absolute
System.out.println(Math.rint(2.1));//0.25 2的2次幂分之1 absolute 返回偶数
System.out.println(Math.round(2.1));//正数四舍五入,负数五舍六入
} }

Math类小结的更多相关文章

  1. Java之Math类使用小结(转发)

    Java的Math类封装了很多与数学有关的属性和方法,大致如下: public class Main { public static void main(String[] args) { // TOD ...

  2. Java之Math类使用小结

    Java的Math类封装了很多与数学有关的属性和方法,大致如下: public class Main { public static void main(String[] args) { // TOD ...

  3. Java学习笔记-Math类

    并非所有的类都需要main方法.Math类和JOptionPane类都没有main方法.这些类中所包含的方法主要是为了供其他类使用. package welcome; public class Tes ...

  4. Math类

    Math类:用于执行基本数学运算的方法 方法: public static int abs(int a):绝对值 public static double ceil(double a):向上取整   ...

  5. 带有静态方法的类(java中的math类)

    带有静态方法的类通常(虽然不一定是这样)不打算被初始化. 可以用私有构造函数来限制非抽象类被初始化. 例如,java中的math类.它让构造函数标记为私有,所以你无法创建Math的实例.但Math类却 ...

  6. Math类中的BigDecimal

    如果我们编译运行下面这个程序会看到什么? public class Test {    public static void main(String args[]) {                 ...

  7. 使用 Date 和 SimpleDateFormat 类表示时间、Calendar类和Math类

    一. Date 和 SimpleDateFormat类表示时间 在程序开发中,经常需要处理日期和时间的相关数据,此时我们可以使用 java.util 包中的 Date 类.这个类最主要的作用就是获取当 ...

  8. string、math类、random随机数、datetime、异常保护

    今天讲的知识点比较多,比较杂,以至于现在脑子里还有点乱,慢慢来吧... string (1)string.length; (获得你string字符串的长度) (2)a = a.Trim(); 重新赋值 ...

  9. 2016年10月12日--string、Math类、Random随机数、DateTime、异常保护

    string string.length; //得到string长度 string.Trim(); //去掉string前后的空格 string.TrimStart(); //去掉string前的空格 ...

随机推荐

  1. ie-"此更新不适应于此电脑"

    cmd-dos命令 expand –F:* C:\update\Windows6.1-KB2533623-x64.msu C:\update\ dism.exe /online /Add-Packag ...

  2. Git工具详解以及与GitHub的配合使用

    git和Github 概念 git --- 版本控制工具(命令). 工具介绍官方网站:http://git-scm.com 工具下载地址:http://git-scm.com/download/ gi ...

  3. [转]深入探讨C语言中局部变量与全局变量的作用域与存储类别

    C语言中局部变量和全局变量变量的作用域与存储类别(auto,static,extern,register) 1.局部变量和全局变量在讨论函数的形参变量时曾经提到,形参变量只在被调用期间才分配内存单元, ...

  4. OSI七层和TCP/IP四层的关系、TCP与UDP、HTTP、Socket

    HTTP(应用层协议):超文本传输协议,HTTP协议是建立在TCP协议之上的一种应用. HTTP协议详细解释 2Http详解 TCP(面向连接的传输层协议):transmission control ...

  5. Nodejs 连接 mysql时报错 Error: Cannot enqueue Query after fatal error

    解决办法,参考:https://github.com/chill117/express-mysql-session/issues/18 我们只需在实例化SessionStore的时候,配置useCon ...

  6. Raymond Mill In Lisp

    Raymond Mill is suitable for producing minerals powder, which is widely used in the metallurgy, buil ...

  7. java注解相关

    本文参考很多大神的文档,特别再次表示感谢分享!! 1.何为注解?  概念:注解(Annotation),也叫元数据.一种代码级别的说明. 它是JDK1.5及以后版本引入的一个特性,与类.接口.枚举是在 ...

  8. Lambda动态排序通用方法

    using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; us ...

  9. Windows下使用beego遇到的问题

    一.解决:cc1.exe: sorry, unimplemented: 64-bit mode not compiled in: 参考链接:http://blog.csdn.net/mecho/art ...

  10. 转---JS 获取鼠标左右键

    原文:http://blog.csdn.net/mine3333/article/details/7291557 function test() { alert(event.x+" &quo ...