Thanks for taking your time to look at my question. This is one of the methods I created for decrypting a message. This isn't the entire code, believe me I have been trying for hours messing with the code, I didnt just hop on here and hope you guys would do it for me, I'm just asking a HOW to do something!
Just so you guys know, I can't really change much from what I currently have because I'm limited based on the assignment.
My problem: I need to make any character that is an "x" equal a SPACE or " ". Basically I'm trying to hardcode every "x" within the string to become a space because it's not printing what it should be.
What I currently have:
public static String decryption(String s, int n)
{
int originalChar, decryptedChar;
String message = "";
char c;
for(int i = 0; i < s.length(); ++i)
{
c = s.charAt(i);
decryptedChar = (int)c;
if(decryptedChar + n > 126)
originalChar = 32 + ((decryptedChar + n) - 113);
// Problem here
if(c.equals("x"))
originalChar.equals(" ");
else
originalChar = decryptedChar + n;
message = message + (char)originalChar;
}//end for loop
return message;
}//end method
I marked the problem area. If anyone can tell me how to do this properly so that I can make any "x" equal " " instead that would be awesome! Thanks for your time.