三个double TO string对比

来源:互联网 发布:2016淘宝客导购源码 编辑:程序博客网 时间:2024/06/04 18:18
double amount11 =121145634541535.0;BigDecimal bigDecimal = new BigDecimal(amount11);BigDecimal db = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP);String str = db.toPlainString();Locale locale = new Locale("en", "US");        NumberFormat currencyFormatter = NumberFormat.getCurrencyInstance(locale);System.out.println(str);System.out.println(Double.toString(amount11));System.out.println(currencyFormatter.format(amount11));121145634541535.001.21145634541535E14$121,145,634,541,535.00
0 0