Skip to content

Instantly share code, notes, and snippets.

@heanzyzabala
Created August 28, 2017 14:34
Show Gist options
  • Save heanzyzabala/e3048807e5122990c63c65558bc41ba5 to your computer and use it in GitHub Desktop.
Save heanzyzabala/e3048807e5122990c63c65558bc41ba5 to your computer and use it in GitHub Desktop.
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