-
-
Save heanzyzabala/e3048807e5122990c63c65558bc41ba5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
String result = ""; | |
if(n == 0) return result; | |
if(n == majorSymbolValue - 1) { | |
return minorSymbol + majorSymbol; | |
} | |
for(int i=0; i < n; i++) { | |
if(n == nextMajorSymbolValue - (int) (nextMajorSymbolValue / 100.0) * 10 + 1) { | |
return result += minorSymbol + nextMajorSymbol; | |
} | |
if(n >= majorSymbolValue) { | |
result += majorSymbol; | |
n -= (majorSymbolValue - 1); | |
continue; | |
} | |
result += minorSymbol; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment