You can get the bytes in a String by calling the String class's get bytes method.
There might be a problem with that because of charset conversions done by some java I/O classes.

Another way...