Simple encryption with a key

Hey.
I was wondering if there are any simple algorithms to look at for encryption with a PSK.

I am playing around with a server client structure where a flash client connects to a java server.

Upon the initial connection the java server sends the flash client a random key that following messages should be encrypted with.

After playing around with it a bit im not sure how to go about making an algorithm/function that takes a key and the encrypted message and returns the original message or the function that takes the original message and key and encrypts it.

Links, help, suggestions, ideas as to how to do this please!

Thanks