This is my first question on this site so I'm not sure how to do this, but my question is as follows: This is just a small piece of a code with multiple methods. I need to print the ASCII codes of all the characters in a String (input from the user). Now I am trying to use a for-loop which scans the first character prints the ASCII code of it, then scans the next one etc. But at the moment its just printing the first character's ASCII code a few times. Obviously there's something wrong with my for-loop but I've been trying to figure it out and I really can't find it.
static String zin(String zin) {
int length = zin.length();
char letter = zin.charAt(0);
int ascii = (int) letter;
for (int i = 0; i < zin.length(); i++ ) {
System.out.println((int) ascii);
}
return zin;
}