Skip to content

Instantly share code, notes, and snippets.

@rwoloszyn
Created October 12, 2016 18:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rwoloszyn/2dd08a73273f369235739949c5a0365a to your computer and use it in GitHub Desktop.
Save rwoloszyn/2dd08a73273f369235739949c5a0365a to your computer and use it in GitHub Desktop.
Reduce decimal points number for double value
DecimalFormat df = new DecimalFormat("#.####");
df.setRoundingMode(RoundingMode.CEILING);
double newLat = Double.valueOf(df.format(coordinates.latitude));
double newLong = Double.valueOf(df.format(coordinates.longitude));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment