ASCII stands for American Standard Code for Information Interchange. Each and every character has it ASCII equivalent number.We can use following way to find ascii equivalent of character.

class AsciiConvert{
public static void main(String arg[]){
char ch='N';
System.out.println((int)ch);
}
}

Output after execution : 78 If we wanted to convert string to ASCII values first we need to convert string into char array then again we apply the method we used above.

class AsciiConvert{
public static void main(String arg[]){
StringBuffer sb = new StringBuffer();
 char[] letters = "test".toCharArray(); 
for (char ch : letters) {
 sb.append((byte) ch); 
} 
System.out.println(sb.toString());
}

Output after execution : 116101115116