java、freemarker保留两位小数
一、Java保留2位小数
double acc = 22.4322;
String accX = String.format("%.2f", acc);
二、freemarker保留两位小数
<#if centerFreeSize??>
${centerFreeSize?string("#.##")}
<#else>
0.00
</#if>
参考地址:http://blog.csdn.net/ming1683/article/details/3195058
java、freemarker保留两位小数的更多相关文章
- Java float保留两位小数或多位小数
Java float保留两位小数或多位小数 方法1:用Math.round计算,这里返回的数字格式的. float price=89.89;int itemNum=3;float totalPr ...
- java double 保留两位小数
java保留两位小数问题: 方式一: 四舍五入 double f = 111231.5585; BigDecimal b = new BigDecimal(f); d ...
- java 四舍五入保留两位小数
// 保留两位小数 System.out.println(Double.parseDouble(String.format("%.2f", 55.5454545454))); // ...
- [Java基础] Java float保留两位小数或多位小数
方法1:用Math.round计算,这里返回的数字格式的. float price=89.89; int itemNum=3; float totalPrice=price*itemNum; floa ...
- java中保留两位小数的方法
1.BigDecimal的setScale // RoundingMode 舍入模式: // 1.UP/DOWN ->基准为数字0: // 2.CEILING/FLOOR ->基准为正负无 ...
- java数字保留两位小数四舍五入
import java.math.BigDecimal; import java.text.DecimalFormat; import java.text.NumberFormat; public c ...
- java四舍五入保留两位小数4种方法
4种方法,都是四舍五入,例: import java.math.BigDecimal; import java.text.DecimalFormat; import java.text.NumberF ...
- java 四舍五入 保留两位小数
1. 格式化字符串 java.text.DecimalFormat df = new java.text.DecimalFormat("#0.00"); float val=Flo ...
- JAVA 保留两位小数
package com.oracle.pojo; import java.math.BigDecimal; import java.text.DecimalFormat; import java.te ...
随机推荐
- python下载链接内容
下面代码下载京东注册码,可接收参数num dir 可以将连接构造成其它网址,比如移动联通网上营业厅的验证码都是固定网址+13位时间戳的结构. #!/usr/bin/python #code utf-8 ...
- spring in action 学习十二:property placeholder 注解的方式实现避免注入外部属性硬代码化
这里的注解是指@PropertySource这个注解.用@PropertySource这个注解加载.properties文件. 案例的目录结构如下: student.properties的代码如下: ...
- 转:Intent与PendingIntent
intent英文意思是意图,pending表示即将发生或来临的事情. PendingIntent这个类用于处理即将发生的事情.比如在通知Notification中用于跳转页面,但不是马上跳转. Int ...
- Android应用开发EditText文本内容变化监听方法
import android.app.Activity; import android.os.Bundle; import android.text.Editable; import android. ...
- 洛谷P3112 [USACO14DEC]后卫马克Guard Mark
题目描述 Farmer John and his herd are playing frisbee. Bessie throws the frisbee down the field, but it' ...
- hdu6188&&百度之星初赛(B) T5
度度熊的交易计划 Problem Description 度度熊参与了喵哈哈村的商业大会,但是这次商业大会遇到了一个难题: 喵哈哈村以及周围的村庄可以看做是一共由n个片区,m条公路组成的地区. 由于生 ...
- 关于Local System/Local Service/Network Service账户
部署或安装系统服务时需要指定服务运行的账户.一般地,可选择Local System.Local Service或Network Service账户. Local System/Local Servic ...
- oracle odbc 驱动安装(不安装oracle客户端)
1.下载odbc驱动 需要下载两个东西 instantclient-basiclite-nt-12.1.0.1.0.zip instantclient-odbc-nt-12.1.0.1.0.zip 由 ...
- windows实时监测热插拔设备的变化(转)
原文转自 https://blog.csdn.net/windows_nt/article/details/13614849 序: 在21世纪,这个信息时代,热插拔设备是一个巨大的安全隐患.在这个篇文 ...
- Instruments Tutorial for iOS: How To Debug Memory Leaks
http://www.raywenderlich.com/2696/instruments-tutorial-for-ios-how-to-debug-memory-leaks Update 4/12 ...