Skip to content

Instantly share code, notes, and snippets.

@Ankit-Slnk
Created March 15, 2023 11:59
Show Gist options
  • Save Ankit-Slnk/ba8f5866f6aeb6ad0163a058357f91a4 to your computer and use it in GitHub Desktop.
Save Ankit-Slnk/ba8f5866f6aeb6ad0163a058357f91a4 to your computer and use it in GitHub Desktop.
Round up a value
public static double roundUp(double toRound) {
if (toRound % 100 == 0) return toRound;
double wholeNumber = toRound * 100;
double roundedValue = Math.ceil(wholeNumber / 10.0) * 10;
return roundedValue / 100;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment