Skip to content

Instantly share code, notes, and snippets.

@vple
Created April 16, 2018 02:45
Show Gist options
  • Save vple/0f6c2904c1303b4013e84b1696480ba3 to your computer and use it in GitHub Desktop.
Save vple/0f6c2904c1303b4013e84b1696480ba3 to your computer and use it in GitHub Desktop.
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