对Double类型的数进行格式化 (0.00E00)
2011-05-06 16:16
281 查看
import java.text.DecimalFormat; public class Test { public static void main(String []args){ double a=2.828718623884379E-4; double b=0.00001714; double c=8.569E-7; System.out.println(getFormat(a)); System.out.println(getFormat(b)); System.out.println(getFormat(c)); } public static String getFormat(double input){ DecimalFormat df = new DecimalFormat( "0.00E0"); String temp1 = df.format(input); return temp1.toString(); } }
相关文章推荐
- 对于java中小数类型用Double或Float进行加减乘除时缺失精度问题
- iOS中对字符串类型的金额进行格式化处理
- Java中将double类型格式化为小数点后两位数字
- C++ Builder 中对编辑框输入double类型数据或只输入字母或数字进行限定
- [置顶] double、float类型进行运算造成精度丢失的问题解决
- 在ArcEngine中对double类型的数据进行模糊匹配查询
- java double数据类型格式化
- 格式化Double类型
- java中如何对Double类型进行四舍五入操作
- 对double数据类型的数据保留两位小数,并且进行四舍五入
- 时间和double类型数据的格式化
- [1]字符串按中文符占3位进行指定长度剪切[2]Double类型截取指定长度(指定长度=整数位+小数位)
- float、double类型的数据格式化
- double类型格式化保留2位小数
- Java DecimalFormat 格式化数字,取2位小数,按位取小数,按要求格式化小数 float,double,int,等类型都支持
- C Primer plus 10.2 初始化一个double类型的数组,然后把该数组的内容拷贝至3个其它的数组中,使用带数组的表示方法的函数进行第一份拷贝,使用带指针表示方法和指针递增的函..
- 对日期类型进行格式化
- Junit中对double类型进行assert对比
- C++中怎么进行string转化为double等类型转换
- 利用IO流进行基本类型同二进制的转换,以double为例