Some_other_guy Some_other_guy - 10 months ago 27
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();