aspose file tools*
The moose likes Beginning Java and the fly likes need help with Decode method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "need help with Decode method" Watch "need help with Decode method" New topic
Author

need help with Decode method

Manu Carruso
Greenhorn

Joined: Sep 30, 2013
Posts: 3
Hi Guys!, im new to the forum. I need a little help with encoding and decoding words. Here are my two methods for encoding and decoding. As of now the output is working for the encoding, but the decoding isnt.


Manu Carruso
Greenhorn

Joined: Sep 30, 2013
Posts: 3
note: Constants.DECODE_SHIFT value is 23.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42599
    
  65
So the "decode" part is not supposed to do the reverse of the "encode" part? In that case you need to tell us what the "decode" part is supposed to do, and how exactly it is not working.


Ping & DNS - my free Android networking tools app
Richard Tookey
Ranch Hand

Joined: Aug 27, 2012
Posts: 1083
    
  10

The two methods are not inverses of one another ! What made you think the decode() method was the inverse of the encode() . The inverse of your encode() method is itself . The decode() method is a caesar cipher and the inverse of it is very very similar to itself.
Manu Carruso
Greenhorn

Joined: Sep 30, 2013
Posts: 3
the encode() method is supposed to reverse characters in a string, while the decode() method is supposed to turn the characters back into the original word.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18886
    
    8

When you say "turn... back into the original word", does that mean the word before you reversed its characters? If so then, no, it doesn't do that. And Richard already pointed out that the way to undo the "reverse the order of characters in the word" operation is simply to do it again. The code in your posted decode() method is irrelevant to that.

Or does it mean something else?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: need help with Decode method