In this program I'm printing a value from a calculation of type double
to the screen.But at present the calculation is giving 14 decimal places.My question is,is there a facility in Java to wrap the output statement in that could specify the amount of decimal places?For example round(mark1,2)
The way it is printed at present is like this:
double markOne = intent.getDoubleExtra("number1", 0);
result1.setText(String.valueOf(markOne)+"mm");
Is it possible to wrap the setText
in a Java method or would I have to create a custom format?Could someone give me an example of this with my code? Thanks