Math类小结
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类小结的更多相关文章
- Java之Math类使用小结(转发)
Java的Math类封装了很多与数学有关的属性和方法,大致如下: public class Main { public static void main(String[] args) { // TOD ...
- Java之Math类使用小结
Java的Math类封装了很多与数学有关的属性和方法,大致如下: public class Main { public static void main(String[] args) { // TOD ...
- Java学习笔记-Math类
并非所有的类都需要main方法.Math类和JOptionPane类都没有main方法.这些类中所包含的方法主要是为了供其他类使用. package welcome; public class Tes ...
- Math类
Math类:用于执行基本数学运算的方法 方法: public static int abs(int a):绝对值 public static double ceil(double a):向上取整 ...
- 带有静态方法的类(java中的math类)
带有静态方法的类通常(虽然不一定是这样)不打算被初始化. 可以用私有构造函数来限制非抽象类被初始化. 例如,java中的math类.它让构造函数标记为私有,所以你无法创建Math的实例.但Math类却 ...
- Math类中的BigDecimal
如果我们编译运行下面这个程序会看到什么? public class Test { public static void main(String args[]) { ...
- 使用 Date 和 SimpleDateFormat 类表示时间、Calendar类和Math类
一. Date 和 SimpleDateFormat类表示时间 在程序开发中,经常需要处理日期和时间的相关数据,此时我们可以使用 java.util 包中的 Date 类.这个类最主要的作用就是获取当 ...
- string、math类、random随机数、datetime、异常保护
今天讲的知识点比较多,比较杂,以至于现在脑子里还有点乱,慢慢来吧... string (1)string.length; (获得你string字符串的长度) (2)a = a.Trim(); 重新赋值 ...
- 2016年10月12日--string、Math类、Random随机数、DateTime、异常保护
string string.length; //得到string长度 string.Trim(); //去掉string前后的空格 string.TrimStart(); //去掉string前的空格 ...
随机推荐
- 移动Web开发规范概述
以下规范建议,均是Alloyteam在日常开发过程中总结提炼出的经验,规范具备较好的项目实践,强烈推荐使用. 字体设置 使用无衬线字体 body { font-family: "Helvet ...
- Unity 行为树-节点间数据传递
一.引言 有以下小场景: 节点A:发现了 敌人. 节点B:追逐敌人. 对于同一个敌人物体,节点AB之间是如何传递数据 的呢? 二.数据传递的3种方式 1.共享变量:面板中创建局部或者全局的共享变量Te ...
- Django 04 模板标签(if、for、url、with、autoeacape、模板继承于引用、静态文件加载)
Django 04 模板标签(if.for.url.with.autoeacape.模板继承于引用.静态文件加载) 一.if.for.url.with.autoescape urlpatterns = ...
- Migrations中的更新语句写法,摘要
public override void Up() { AlterColumn("dbo.Dispositions", "Property1", c => ...
- Tensorflow安装教程-Win10环境下
背景:最新版的Tensoflow已经支持Python3.6 首先,下载并安装Anaconda3 内置Python3.6的版本 https://www.continuum.io/downloads 安装 ...
- Oracle存储过程实例分析总结(代码)
1.存储过程结构 1.1 第一个存储过程 ? 1 2 3 4 5 6 7 8 9 10 11 12 CREATE OR REPLACE PROCEDURE proc1 ( para1 varc ...
- FTP服务器FileZilla Server配置及使用方法
FileZilla Server下载安装完成后,安装过程不写说明了,网上一抓一大把,直接从配置开始记录. 1.创建服务器 ² Password:栏位中输入本服务器Filezilla服务的密码, ² ...
- nodejs加密解密
nodejs是通集成在内核中的crypto模块来完成加密解密. 常用加密解密模块化代码: /** * Created by linli on 2015/8/25. */ var crypto = re ...
- 与 HTML4 比较,HTML5 废弃了哪些元素?
frame frameset noframe applet big center basefront
- C#字符串自增自减算法
本文URL:http://www.cnblogs.com/CUIT-DX037/p/6770535.html 实现字符串自增和自减运算: 1.数字从 0-9 变化: 2.字母从 A-Z.a-z 变化: ...