Some_other_guy Some_other_guy - 8 months ago 19
Java Question

Convert an integer to an array of characters : java

What is the best way to convert an integer into a character array?

Input: 1234

Output: {1,2,3,4}

Keeping in mind the vastness of Java language what will be the best and most efficient way of doing it?

int i = 1234;
char[] chars = ("" + i).toCharArray();