I'm trying to convert a integer number to an array of chars without using String operations.
My attempt was:
int number = 12;
char[] test = Character.toChars(number);
for (char c : test)
System.out.println(c);
There is no output, and should give me:
'1'
'2'
How can I fix this? Thank you!
Integer.toString()and the related methods.Stringoperations? In my long career, nobody has ever placed such a restriction on me.Character.toChars()method actually does. It "Converts the specified character (Unicode code point) to its UTF-16 representation stored in a char array." Itsintparameter specifies "a Unicode code point"