I have this
Java Code:
public class Mapper implements ScramblerIF{
private static String map = "drsjckpwrypwsftylmzxopqtdo";

public static String charAt(String str) 
{
	//char[] chars = str.toCharArray();
int length = str.length();

	for(int i=0; i<length; i++)
{
	char aChar = str.charAt(i);
	char upper = Character.toUpperCase(aChar);
	int num = (upper - 'A');
char mChar = map.charAt(num);
	//String chard = Character.toString(mChar);
	
	StringBuffer buf = new StringBuffer( str);
	  buf.setCharAt( i, mChar );
	}
	  return str;
	}

public String scramble(String str) {
return charAt(str);
	}
}
I am trying to get it to where the method
Java Code:
 public String scramble(String str) {
return charAt(str);
	}
returns the computed value from
Java Code:
 public static String charAt(String str)
method. Don't know where i went wrong.

Also instead of using
Java Code:
StringBuffer buf = new StringBuffer( str);
	  buf.setCharAt( i, mChar );
how would i be able to use the swap function?
When I try
Java Code:
 char temp = chars[i];
chars[i] = chars[mChar];
chars[mChar] = temp;
I am given an ArrayIndexOutOfBoundsException.
Summary of what i am trying to do is "For each character in the original string, use its position in the alphabet to look up its replacement in the map string. For example, the string “dog” would be translated to “jtp”."