Is the assignment to create a "compression" of some text to valid text that can be placed in a java String and then to write java code that will extract the original text from the contents of that String?
The compression step that creates the "compressed text" String can be done with another program or manually.