您的位置:首页 > 其它

对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();
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: