This week's book giveaway is in the Agile and Other Processes forum. We're giving away four copies of Software Teaming: A Mob Programming, Whole-Team Approach and have Woody Zuill and Kevin Meadows on-line! See this thread for details.
Why are you converting a byte into a StringBuffer/String? Seems odd to me. Anyway, one way to reverse a process is to reverse each step. For example, how can you convert "A0" back to a byte? Take a look at the methods of Integer. In the final step, to convert a byte to an Image, take a look at class javax.imageio.ImageIO, or see if whatever you used to convert an image in jpeg format to a byte can be reversed.
Originally posted by Jeff Albertson: Take a look at Integer.parseInt
Why are you converting an image to a String?
I'm using the Base 64 implementation shown above but i've encountered something weird. I thought base64 encoding returns only digits whereas i'm getting all sorts of stuff. For example: /9j/4AAQSkZJRg (that's the beginning of an encoded jpeg image). The encoding and decoding works fine, but i'm asking because another part of the system is going to have to use the encoded data and decode it itself. I don't want any problems to pop-up when that happens else my necks on the chopping block
That's okay. Think about it: in hex (base 16) you need 16 digits: 0-9 plus A-F. In base 64 you need 64 digits: 0-9 plus A-Z plus a-z plus '+' and '/' (usually). You can read more about it on Wikipedia: http://en.wikipedia.org/wiki/Base64