Error in decrypte caesar chipher

Can anyone help me

public static String Decrypt(String str, int key, String letters){

	String decrypted= "";
	for(int pos=0;pos < str.length();++pos){
		char c=str.charAt(pos);
		if (c == ' '){
			decrypted += c;
		int ind=letters.indexOf(c);
		int ncpos=(ind-key)%26;
		decrypted += letters.charAt(ncpos);
	return decrypted;

when run this error display
Exception in thread “main” java.lang.StringIndexOutOfBoundsException: String index out of range: 26
at java.lang.String.charAt(
at CaesarCipherLab.Decrypt(
at CaesarCipherLab.main(

What where the inputs to your method?