I suspect you are just interested in converting from charto int, which is implicit:
for (int i = 0; i < text.length(); i++)
{
char c = text.charAt(i);
int value = c;
System.out.println(value);
}
EDIT: if you want to handle surrogate pairs, you can use something like:
for (int i = 0; i < text.length(); i++)
{
int codePoint = text.codePointAt(i);
if (codePoint > 0xffff)
{
i++;
}
System.out.println(codePoint);
}
source
share