I want to display GPS coordinates upto just 6 decimal places. e.g. if my GPS location is something like x.yyyyyyyyyy
I want to display just x.yyyyyy
and for this I use DecimalFormat
class. But, if the number is like 8.3456709012
, the output for the following code is like 8.34568
_yPos = 8.3456709012;
DecimalFormat decimalFormat = new DecimalFormat("#.######");
String yCoord = decimalFormat.format(_yPos);
whereas the expected output is 8.345670
. Can anybody show me a way to do this?