Update Encode.java

This part of the program was not written by me, but it is necessary for the program to work.