Created
April 16, 2018 02:45
-
-
Save vple/0f6c2904c1303b4013e84b1696480ba3 to your computer and use it in GitHub Desktop.
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 String int2String(int n) { | |
List<String> digits = new ArrayList<>(); | |
while (n > 0) { | |
int digit = n % 10; | |
digits.add(digit2String(digit)); | |
n = n / 10; | |
} | |
String result = ""; | |
for (int i = digits.size() - 1; i >= 0; i--) { | |
result += digits.get(i); | |
} | |
return result; | |
} | |
public static String digit2String(int digit) { | |
// Chosen implementation here... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment