Created
March 15, 2023 11:59
-
-
Save Ankit-Slnk/ba8f5866f6aeb6ad0163a058357f91a4 to your computer and use it in GitHub Desktop.
Round up a value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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