If you can't solve encryption, then you can't solve decryption, because you don't have "genuine" encrypted examples to test against. And since decryption is the exact reverse of encryption solving one pretty much gives you the code for the other!
This is a minor variation of the Caesar Cypher: and you will find many, many examples of that implemented in pretty much every language:
Caesar Cypher java - Google Search[
^] offers 68,000 hits.
But do bear in mind that a Caesar Cypher isn't "real encryption", and isn't at all secure - they publish whole magazines full of them (generally called "Codebreaker" or similar) every month so really bored people can solve them in their spare time instead of watching Jeremy Kyle or yet another putrid game show...