The character itself gets converted into the ascii code, once we make the character an integer.
You can either cast it,
String name = "admin";
String char = name.substring(0,1); //char="a"
int ascii = (int) char;
OR
You can directly convert the character to int
String name = "admin";
String char = name.substring(0,1); //char="a"
int ascii = char;