int to char array in Java

There are many ways to convert a primitive integer to array in Java.

Cast as String

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

String class

char[] chars = String.valueOf(1234).toCharArray();