0

I want to print amount like 2523525252.025 when I using double data type it's changed in 2.523525252025E9 how can fix?

Example -

Double saleprice=145236.12;
int itemqountity=1500;
Double totalamount= saleprice*itemqountity;
Log.e("totalamount",""+totalamount);

output-

E/totalamount: 2.1785418E8

V-rund Puro-hit
  • 5,518
  • 9
  • 31
  • 50
Deven Mer
  • 145
  • 1
  • 7

2 Answers2

2

Please use DecimalFormat to print your value without scientific notation here is an example.

double test = 12345678; 
DecimalFormat df = new DecimalFormat("#"); 
df.setMaximumFractionDigits(0); 
System.out.println(df.format(test)); 
//12345678
V-rund Puro-hit
  • 5,518
  • 9
  • 31
  • 50
Irfan Babar
  • 122
  • 9
1
BigDecimal bigDecimal = new BigDecimal(2.523525252025E9);
System.out.println(bigDecimal.toPlainString());
anemomylos
  • 546
  • 1
  • 6
  • 14