I want only 2 decimals in my code. How can i do that?
Here is my coding:
double conta1 = ((num1*35)/100)*1.05;
bomba1.setText(Double.toString(conta1));
Num1=55
Well i only want to result to be 20.21 instead of 20.212500000...
How can I do that?
I want only 2 decimals in my code. How can i do that?
Here is my coding:
double conta1 = ((num1*35)/100)*1.05;
bomba1.setText(Double.toString(conta1));
Num1=55
Well i only want to result to be 20.21 instead of 20.212500000...
How can I do that?
Try this code:
bomba1.setText(new DecimalFormat("#.##").format(conta1));