Use This tutorial for encoding/decoding into different formats. You can then write out the values to the file using the FileWriter class as copeg said.